<commit_before>#!/usr/bin/env python

__all__ = ['sohu_download']

from common import *

def real_url(host, prot, file, new):
	url = 'http://%s/?prot=%s&file=%s&new=%s' % (host, prot, file, new)
	start, _, host, key, _ = get_html(url).split('|')
	return '%s%s?key=%s' % (start[:-1], new, key)

def sohu_download(url):
	vid = r1('vid="(\d+)"', get_html(url))
	assert vid
	import json
	data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % vid))
	host = data['allot']
	prot = data['prot']
	urls = []
	data = data['data']
	title = data['tvName']
	size = sum(data['clipsBytes'])
	assert len(data['clipsURL']) == len(data['clipsBytes']) == len(data['su'])
	for file, new in zip(data['clipsURL'], data['su']):
		urls.append(real_url(host, prot, file, new))
	assert data['clipsURL'][0].endswith('.mp4')
	download_urls(urls, title, 'mp4', total_size=size, refer=url)

download = sohu_download
download_playlist = playlist_not_supported('sohu')

def main():
	script_main('sohu', sohu_download)

if __name__ == '__main__':
	main()

<commit_msg>fix sohu<commit_after>#!/usr/bin/env python

__all__ = ['sohu_download']

from common import *

def real_url(host, prot, file, new):
	url = 'http://%s/?prot=%s&file=%s&new=%s' % (host, prot, file, new)
	start, _, host, key, _, _ = get_html(url).split('|')
	return '%s%s?key=%s' % (start[:-1], new, key)

def sohu_download(url):
	vid = r1('vid="(\d+)"', get_html(url))
	assert vid
	import json
	data = json.loads(get_decoded_html('http://hot.vrs.sohu.com/vrs_flash.action?vid=%s' % vid))
	host = data['allot']
	prot = data['prot']
	urls = []
	data = data['data']
	title = data['tvName']
	size = sum(data['clipsBytes'])
	assert len(data['clipsURL']) == len(data['clipsBytes']) == len(data['su'])
	for file, new in zip(data['clipsURL'], data['su']):
		urls.append(real_url(host, prot, file, new))
	assert data['clipsURL'][0].endswith('.mp4')
	download_urls(urls, title, 'mp4', total_size=size, refer=url)

download = sohu_download
download_playlist = playlist_not_supported('sohu')

def main():
	script_main('sohu', sohu_download)

if __name__ == '__main__':
	main()


{'fraction_non_alphanumeric': 0.2124765478424015, 'fraction_numerical': 0.004690431519699813, 'mean_word_length': 5.814696485623003, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6102888', 'n_tokens_mistral': 856, 'n_tokens_neox': 858, 'n_words': 167}