glogglog

download youtubu video using flashgot

urrent(2009-03-22) flashgot does not fake the User-Agent HTTP header as Firefox if downloading using wget, I dont know how other download manager is. This is not a big problem if you does not download videos(like flv) from a video site which deny wget according the User-Agent HTTP header.

But I found almost all video sites check this header for proventing thief, so the video detecter of flashgot become not so useful.

Actually, wget do have parameter "-U,  --user-agent=AGENT" to fake the HTTP header, so the solution is here:

This python script is a proxy when flashgot call wget to download, it add user-agent "Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.0.7) Gecko/2009030422 Ubuntu/8.10 (intrepid) Firefox/3.0.7 GTB5"(my firefox version) when invoke wget.

To use it,

1.save it as "dflv" to some directory like ~/bin

2.config flashgot, add a new download manager, name it "dflv", the executable path should be the file path you saved in [1], and arguments template *must* be "[FOLDER] [REFERER] [CFILE] [UFILE]"(with out the quote mark)

OK, now you can doanload vide by short-cut key Ctrl+F7

notice:

only OS with python and wget and xterm supported, I think most Linux and freebsd have them. Windows which installed python and wget should be supported, I'll give a try later cause no Windows at hand.

File:

-------------------------------------------------------------------------------

#!/usr/bin/python

import os
import sys
from datetime import datetime

log = False

logdir = os.path.expanduser("~/.dflv")
dfname = datetime.now().isoformat()

log and os.makedirs(os.path.sep.join([logdir,dfname]))
logfile = os.path.sep.join([logdir,dfname,'log'])
wgetlogfile = os.path.sep.join([logdir,dfname,'wgetlog'])

log = log and open(logfile,'w')

try:
    ua = "Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.0.7) Gecko/2009030422 Ubuntu/8.10 (intrepid) Firefox/3.0.7 GTB5"

    log and log.write(' '.join(sys.argv))
   
    _, folder, referer, cookiefile, urlfile = sys.argv

    cmd = '''xterm -e 'wget -c -P "%s" --content-disposition -U "%s" --referer="%s" --load-cookies="%s" -i "%s";read -n 1 -s' ''' % (folder, ua, referer, cookiefile, urlfile)

    log and log.write(cmd + '\n')

    os.system(cmd)
except Exception,e:
    log and log.write(str(e) + '\n')



Tags: python | flashgot |

Blogs refer to this post:
nfvlnefs:nfvlnefs
Casino 1240948969:Casino 1240948969
Casino 1241005491:Casino 1241005491
Casino 1241034633:Casino 1241034633
Casino 1241119135:Casino 1241119135
Casino 1241180872:Casino 1241180872
Casino 1241213723:Casino 1241213723
Casino 1241225550:Casino 1241225550
Casino 1241270381:Casino 1241270381
Casino 1241357512:Casino 1241357512
Casino 1241384700:Casino 1241384700
Casino 1241492513:Casino 1241492513
Casino 1241540687:Casino 1241540687
Casino 1241632249:Casino 1241632249
Casino 1241669329:Casino 1241669329
Casino 1241717752:Casino 1241717752
Casino 1242192188:Casino 1242192188
Casino 1242192840:Casino 1242192840
Casino 1242791359:Casino 1242791359


sevenever@gmail.com
Copyright © 2008. All rights reserved.