Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#6 Parameters in the youtube video links

Unstable_(example)
pending
nobody
None
5
2013-05-06
2012-12-19
JosephDkE
No

Hello... I'm newbie in sourceforge, but your src is very usefull, and i want to help you a bit... The parameters in the links in youtube may be unordered... so the lines in class YTDownloadThread:

String[] fmtUrlPair = urlString.split("&url=");
fmtUrlPair[0] = fmtUrlPair[0].replaceFirst("itag=", "");

must have been changed for:

HashMap<String, String=""> hash = new HashMap<String, String="">();
StringTokenizer st = new StringTokenizer( urlString, "&" );
while( st.hasMoreTokens() ){
StringTokenizer st2 = new StringTokenizer( st.nextToken(), "=" );
hash.put(st2.nextToken(), st2.nextToken());
}
String[] fmtUrlPair = new String[2];
fmtUrlPair[0] = hash.get( "itag" );
fmtUrlPair[1] = hash.get( "url" )+"&sig="+hash.get( "sig" );

......
......

fmtUrlPair[1] = fmtUrlPair[1].replaceFirst("http%3A%2F%2F", "http://"); .. etc...

Cya!

JosephDkE

Related

Patches: #6

Discussion

  • StefanKaerst
    StefanKaerst
    2013-05-06

    Hi JosephDkE,

    thanks for your code.
    sorting the parameters does not change the way ytd2 runs, does it? what is it good for?

    btw: a patch is easier to implement. try get familiar with it. ;-)

    Regards
    Stefan

     
    Last edit: StefanKaerst 2013-05-06
  • JosephDkE
    JosephDkE
    2013-05-07

    Hi Stefan:

    If the parameter "url" becomes first of the parameter "itag" in the link
    (like happened to me in some cases) the lines:

    String[] fmtUrlPair = urlString.split("&url=");
    fmtUrlPair[0] = fmtUrlPair[0].replaceFirst("itag=", "");

    don't work because in "fmtUrlPair[0]" doesn't exists itag.

    Cya!

    On Mon, May 6, 2013 at 2:20 AM, StefanKaerst stefankaerst@users.sf.netwrote:

    • status: open --> pending
    • Priority: 1 --> 5

    Status: pending

    Created: Wed Dec 19, 2012 05:34 AM UTC by JosephDkE
    Last Updated: Mon May 06, 2013 07:19 AM UTC
    Owner: nobody

    Hello... I'm newbie in sourceforge, but your src is very usefull, and i
    want to help you a bit... The parameters in the links in youtube may be
    unordered... so the lines in class YTDownloadThread:

    String[] fmtUrlPair = urlString.split("&url=");
    fmtUrlPair[0] = fmtUrlPair[0].replaceFirst("itag=", "");

    must have been changed for:

    HashMap hash = new HashMap();
    StringTokenizer st = new StringTokenizer( urlString, "&" );
    while( st.hasMoreTokens() ){
    StringTokenizer st2 = new StringTokenizer( st.nextToken(), "=" );
    hash.put(st2.nextToken(), st2.nextToken());
    }
    String[] fmtUrlPair = new String[2];
    fmtUrlPair[0] = hash.get( "itag" );
    fmtUrlPair[1] = hash.get( "url" )+"&sig="+hash.get( "sig" );

    ......
    ......

    fmtUrlPair[1] = fmtUrlPair[1].replaceFirst("http%3A%2F%2F", "http://");
    .. etc...

    Cya!

    JosephDkE

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/ytd2/patches/6/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Patches: #6


Anonymous


Cancel   Add attachments