コード例 #1
0
ファイル: lyrics_download_samples.py プロジェクト: AGSD/beets
def main(argv=None):
    """Download one lyrics sample page per referenced source.
    """
    if argv is None:
        argv = sys.argv

    for s in test_lyrics.GOOGLE_SOURCES + test_lyrics.DEFAULT_SOURCES:
        print 'Fetching sample from %s' % s['url']
        url = s['url'] + s['path']
        fn = test_lyrics.url_to_filename(url)
        if not os.path.isfile(fn):
            html = requests.get(url).text
            with safe_open_w(fn) as f:
                f.write(html.encode('utf8'))
コード例 #2
0
def main(argv=None):
    """Download one lyrics sample page per referenced source.
    """
    if argv is None:
        argv = sys.argv
    print('Fetching samples from:')
    for s in test_lyrics.GOOGLE_SOURCES + test_lyrics.DEFAULT_SOURCES:
        print(s['url'])
        url = s['url'] + s['path']
        fn = test_lyrics.url_to_filename(url)
        if not os.path.isfile(fn):
            html = requests.get(url, verify=False).text
            with safe_open_w(fn) as f:
                f.write(html.encode('utf-8'))
コード例 #3
0
def main(argv=None):
    """Download one lyrics sample page per referenced source.
    """
    if argv is None:
        argv = sys.argv

    for s in test_lyrics.GOOGLE_SOURCES + test_lyrics.DEFAULT_SOURCES:
        url = s['url'] + s['path']
        fn = test_lyrics.url_to_filename(url)
        if not os.path.isfile(fn):
            html = requests.get(url).text
            with safe_open_w(fn) as f:
                print 'Writing %s' % fn
                f.write(html.encode('utf8'))