1717
1818import java .util .ArrayList ;
1919
20- import org .appwork .utils .StringUtils ;
21- import org .jdownloader .plugins .components .antiDDoSForDecrypt ;
20+ import org .appwork .utils .parser .UrlQuery ;
2221
2322import jd .PluginWrapper ;
2423import jd .controlling .ProgressController ;
2524import jd .http .Browser ;
2625import jd .nutils .encoding .Encoding ;
2726import jd .nutils .encoding .HTMLEntities ;
28- import jd .parser .Regex ;
2927import jd .parser .html .Form ;
3028import jd .plugins .CryptedLink ;
3129import jd .plugins .DecrypterException ;
3230import jd .plugins .DecrypterPlugin ;
3331import jd .plugins .DownloadLink ;
3432import jd .plugins .LinkStatus ;
3533import jd .plugins .PluginException ;
34+ import jd .plugins .PluginForDecrypt ;
3635import jd .plugins .components .SiteType .SiteTemplate ;
3736
3837/**
3938 * This class supports, http://mfscripts.com/short_url_script.html template.
4039 *
4140 * @author raztoki
4241 */
43- @ DecrypterPlugin (revision = "$Revision: 49678 $" , interfaceVersion = 3 , names = { "mfs_shorturlscript" , " gourl.us", "shori.xyz" }, urls = { "https?://(?:www\\ .)?nullified \\ .jdownloader \\ .org/([a-zA-Z0-9]+)" , "https?://(?:www \\ .)? gourl\\ .us/([a-zA-Z0-9_ \\ -]+)$" , "https?://(?:www \\ .)?shori \\ .xyz /([a-zA-Z0-9_\\ -]+)$" })
44- public class MFS_ShortUrlScript extends antiDDoSForDecrypt {
42+ @ DecrypterPlugin (revision = "$Revision: 50037 $" , interfaceVersion = 3 , names = { "gourl.us" }, urls = { "https?://(?:www\\ .)?gourl\\ .us/([a-zA-Z0-9_\\ -]+)$" })
43+ public class MFS_ShortUrlScript extends PluginForDecrypt {
4544 public MFS_ShortUrlScript (PluginWrapper wrapper ) {
4645 super (wrapper );
4746 }
@@ -54,54 +53,44 @@ public Browser createNewBrowserInstance() {
5453 }
5554
5655 public ArrayList <DownloadLink > decryptIt (final CryptedLink param , final ProgressController progress ) throws Exception {
57- final String parameter = param .toString ().replaceFirst ("^http://" , "https://" );
58- final String fuid = new Regex (parameter , this .getSupportedLinks ()).getMatch (0 );
59- getPage (parameter );
60- if (StringUtils .containsIgnoreCase (br .getURL (), "/error.html?" )) {
56+ final String parameter = param .getCryptedUrl ().replaceFirst ("^http://" , "https://" );
57+ // final String fuid = new Regex(parameter, this.getSupportedLinks()).getMatch(0);
58+ br .getPage (parameter );
59+ final String errorFromURL = UrlQuery .parse (br .getURL ()).get ("e" );
60+ if (errorFromURL != null ) {
61+ throw new PluginException (LinkStatus .ERROR_FILE_NOT_FOUND );
62+ } else if (br .getHttpConnection ().getResponseCode () == 404 ) {
6163 throw new PluginException (LinkStatus .ERROR_FILE_NOT_FOUND );
6264 }
6365 final int repeat = 3 ;
6466 Form pwform = getPasswordForm (br );
65- for (int i = 0 ; i <= repeat ; i ++) {
66- if (pwform == null ) {
67- throw new PluginException (LinkStatus .ERROR_PLUGIN_DEFECT , "Could not find password form" );
68- }
69- final String pass = getUserInput ("Password protected link" , param );
70- if (inValidate (pass )) {
71- throw new DecrypterException (DecrypterException .PASSWORD );
72- }
73- pwform .put ("accessPass" , Encoding .urlEncode (pass ));
74- submitForm (pwform );
75- pwform = getPasswordForm (br );
76- if (pwform == null ) {
77- logger .info ("User has entered correct password: " + pass );
78- break ;
79- }
80- if (i + 1 >= repeat ) {
81- logger .warning ("Incorrect solve of password" );
82- throw new DecrypterException (DecrypterException .PASSWORD );
67+ if (pwform != null ) {
68+ for (int i = 0 ; i <= repeat ; i ++) {
69+ final String pass = getUserInput ("Password protected link" , param );
70+ pwform .put ("accessPass" , Encoding .urlEncode (pass ));
71+ br .submitForm (pwform );
72+ pwform = getPasswordForm (br );
73+ if (pwform == null ) {
74+ logger .info ("User has entered correct password: " + pass );
75+ break ;
76+ }
77+ if (i + 1 >= repeat ) {
78+ logger .warning ("Incorrect solve of password" );
79+ throw new DecrypterException (DecrypterException .PASSWORD );
80+ }
81+ /* Try again */
82+ continue ;
8383 }
84- /* Try again */
85- continue ;
8684 }
8785 final ArrayList <DownloadLink > ret = new ArrayList <DownloadLink >();
8886 final String frame = br .getRegex ("<frame [^>]*src=\" (interstitualAdTop\\ .php\\ ?url=\\ d+)\" " ).getMatch (0 );
8987 if (frame == null ) {
9088 throw new PluginException (LinkStatus .ERROR_PLUGIN_DEFECT );
9189 }
92- getPage (frame );
90+ br . getPage (frame );
9391 String link = br .getRegex ("<a [^>]*[^\\ S]*href=\" (.*?)\" class=[^>]+>skip advert\\ s*</a>" ).getMatch (0 );
9492 if (link == null ) {
95- link = br .getRegex ("<a [^>]*href=\" (sk_redirect_ads\\ .html\\ ?url=" + fuid + ")\" " ).getMatch (0 );
96- if (link != null ) {
97- final Browser br2 = br .cloneBrowser ();
98- getPage (br2 , link );
99- link = br2 .getRedirectLocation ();
100- if (link == null ) {
101- logger .warning ("Possible Plugin Defect, confirm in browser: " + parameter );
102- return null ;
103- }
104- }
93+ throw new PluginException (LinkStatus .ERROR_PLUGIN_DEFECT );
10594 }
10695 ret .add (createDownloadlink (HTMLEntities .unhtmlentities (link )));
10796 return ret ;
@@ -120,12 +109,4 @@ public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {
120109 public SiteTemplate siteTemplateType () {
121110 return SiteTemplate .MFScripts_Wurlie ;
122111 }
123-
124- @ Override
125- public Boolean siteTesterDisabled () {
126- if ("mfs_shorturlscript" .equalsIgnoreCase (this .getHost ())) {
127- return Boolean .TRUE ;
128- }
129- return super .siteTesterDisabled ();
130- }
131112}
0 commit comments