/plowshare_duckload.diff

http://gsbabil.googlecode.com/ · Unknown · 128 lines · 127 code · 1 blank · 0 comment · 0 complexity · aac28da100a4c3f124db31064ad67546 MD5 · raw file

  1. Index: src/core.sh
  2. ===================================================================
  3. --- src/core.sh (revision 1462)
  4. +++ src/core.sh (working copy)
  5. @@ -698,7 +698,9 @@
  6. local TEXT2='Enter captcha response (drop punctuation marks, case insensitive): '
  7. # X11 server installed ?
  8. - if [ -n "$DISPLAY" ] && check_exec 'display'; then
  9. + if [ -n "$DISPLAY" ] && check_exec 'prompt_captcha.py'; then
  10. + RESPONSE=$(prompt_captcha.py $FILENAME)
  11. + elif [ -n "$DISPLAY" ] && check_exec 'display'; then
  12. display $FILENAME &
  13. PID=$!
  14. log_notice $TEXT1
  15. Index: src/modules/duckload.sh
  16. ===================================================================
  17. --- src/modules/duckload.sh (revision 0)
  18. +++ src/modules/duckload.sh (revision 0)
  19. @@ -0,0 +1,96 @@
  20. +#!/bin/bash
  21. +#
  22. +# duckload.com module
  23. +# Copyright (c) 2011 Plowshare team
  24. +#
  25. +# This file is part of Plowshare.
  26. +#
  27. +# Plowshare is free software: you can redistribute it and/or modify
  28. +# it under the terms of the GNU General Public License as published by
  29. +# the Free Software Foundation, either version 3 of the License, or
  30. +# (at your option) any later version.
  31. +#
  32. +# Plowshare is distributed in the hope that it will be useful,
  33. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  35. +# GNU General Public License for more details.
  36. +#
  37. +# You should have received a copy of the GNU General Public License
  38. +#
  39. +
  40. +MODULE_DUCKLOAD_REGEXP_URL="http://\(www\.\)\?duckload\.com/"
  41. +MODULE_DUCKLOAD_DOWNLOAD_OPTIONS=""
  42. +MODULE_DUCKLOAD_DOWNLOAD_CONTINUE=""
  43. +MODULE_DUCKLOAD_UPLOAD_OPTIONS=""
  44. +MODULE_DUCKLOAD_DELETE_OPTIONS=""
  45. +MODULE_DUCKLOAD_LIST_OPTIONS=""
  46. +
  47. +# Output DuckLoad download URL
  48. +# $1: duckload url
  49. +# stdout: real file download link
  50. +duckload_download() {
  51. +
  52. + URL="$1"
  53. + AGENT="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322)"
  54. + BASE_URL="http://www.duckload.com/jDownloader"
  55. +
  56. + URL_checkOnlineStatus="$BASE_URL/checkOnlineStatus.php"
  57. + URL_getFree="$BASE_URL/getFree.php"
  58. + URL_getFreeEncrypt="$BASE_URL/getFreeEncrypt.php"
  59. +
  60. + log_debug "[*] checking online status"
  61. + STATUS=$(curl \
  62. + --silent \
  63. + --user-agent "$AGENT" \
  64. + --data-urlencode "isPremium=0" \
  65. + --data-urlencode "list=$URL" "$URL_checkOnlineStatus" \
  66. + --output -)
  67. +
  68. + log_debug $STATUS
  69. + if matchi "ERROR;" "$STATUS" || matchi "OFFLINE" "$STATUS"
  70. + then
  71. + if matchi "OFFLINE" "$STATUS"
  72. + then
  73. + log_error "[*] file not currently available"
  74. + return 254
  75. + fi
  76. + fi
  77. +
  78. + log_debug "[*] getting free slots"
  79. + STATUS=$(curl \
  80. + --silent \
  81. + --user-agent "$agent" \
  82. + --referer "$URL_checkOnlineStatus" \
  83. + --data-urlencode "link=$URL" "$URL_getFree" \
  84. + --output -)
  85. +
  86. + log_debug $STATUS
  87. + if matchi "ERROR;" "$STATUS"
  88. + then
  89. + log_error "[*] error getting free download slot"
  90. + return 3
  91. + fi
  92. +
  93. + time=$(echo "$STATUS" | cut -d ";" -f 2 | strip)
  94. + crypt=$(echo "$STATUS" | cut -d ";" -f 3 | strip)
  95. +
  96. + log_debug "[*] free user delay "
  97. + wait $time || return 2
  98. +
  99. + log_debug "[*] getting final url"
  100. + STATUS=$(curl \
  101. + --silent \
  102. + --user-agent "$AGENT" \
  103. + --referer "$URL_getFree" \
  104. + --data-urlencode "crypt=$crypt" "$URL_getFreeEncrypt" \
  105. + --output -)
  106. +
  107. + log_debug $STATUS
  108. + if matchi "http" "$STATUS"
  109. + then
  110. + log_debug "[*] starting download: $STATUS"
  111. + echo "$STATUS"
  112. + else
  113. + return 1
  114. + fi
  115. +}
  116. Index: src/modules/config
  117. ===================================================================
  118. --- src/modules/config (revision 1462)
  119. +++ src/modules/config (working copy)
  120. @@ -9,6 +9,7 @@
  121. depositfiles| download | | | list |
  122. divshare | download | | | |
  123. dl_free_fr | download | upload | | |
  124. +duckload | download | | | |
  125. euroshare_eu| download | | | |
  126. fileserve | download | upload | | list |
  127. filesonic | download | upload | delete | list |