Downloading and playing .TS files -- MPEG-2 Transport Streams (MPEG-2 TS)
- They are MPEG-2 files !!
- with extra metadata
https://w3c.github.io/media-source/mp2t-byte-stream-format.html#mpeg2ts-general
- Just concat and store with .MPEG extension and play !!
- You can start playing the file on VLC and most good players while it being downloaded :) if it is getting downloaded fast enough
Some other useful material that I found but did not use directly:
https://github.com/linnovate/replay-infra/wiki/How-to-stream-Videos-and-TS-files,-and-also-manipulate-them-for-your-needs
https://pypi.org/project/ts2mkv/
-x-x-x-
Requirements.txt
-x-x-x-
backcall==0.1.0
certifi==2019.9.11
chardet==3.0.4
decorator==4.4.0
idna==2.8
ipython==7.8.0
ipython-genutils==0.2.0
jedi==0.15.1
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
pkg-resources==0.0.0
prompt-toolkit==2.0.9
ptyprocess==0.6.0
Pygments==2.4.2
requests==2.22.0
six==1.12.0
traitlets==4.3.2
urllib3==1.25.6
wcwidth==0.1.7
-x-x-x-
Code snippet
-x-x-x-
import requests
import mimetypes
from sys import stdout
import datetime
# constants
name_of_movie = "BatmanBegins"
mega_num = (1.0 * 10**6)
kilo_num = (1.0 * 10**3)
file_extension = '.mpeg'
def download_segment(segment_num, retry_count):
print("segment number: ", segment_num)
# st_timestamp = int(datetime.datetime.timestamp(datetime.datetime.now()))
# exp_timestamp = st_timestamp + 14400
# Get the below params by copying as a curl request and copy params form it
###########################################################################
# curl 'https://stream-4-1.loadshare.org/stream/VideoID-T7FoO8Rj/sK3RwIL_vVk847uYQcGnZCHEQyJLpu8Ne7dku2LiFS1x_Q3m5K31we-iZGy6qxDyrU_BbpXzwY3d30RCYZBWqno1meqbAUJafo6Ig3kVyezv77Z5WZDPj27xcqqtJpDy/seg-9-v1-a1.ts?token=ip=43.224.158.218~st=1570361336~exp=1570375736~acl=/*~hmac=6fe771d9ad8fd6ba1f01c4570fe03432ce24d59ce942b934e5dbbb6ef8e13723' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://solarmovie.fun/movie/batman-begins/70i0QI31-watch-free-online.html' -H 'Origin: https://solarmovie.fun' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36' --compressed
###########################################################################
st_timestamp = 1570361336
exp_timestamp = 1570375736
download_url = 'https://stream-4-1.loadshare.org/stream/VideoID-T7FoO8Rj/sK3RwIL_vVk847uYQcGnZCHEQyJLpu8Ne7dku2LiFS1x_Q3m5K31we-iZGy6qxDyrU_BbpXzwY3d30RCYZBWqno1meqbAUJafo6Ig3kVyezv77Z5WZDPj27xcqqtJpDy/seg-'+ str(segment_num) +'-v1-a1.ts?token=ip=43.224.158.218~st='+str(st_timestamp)+'~exp='+str(exp_timestamp)+'~acl=/*~hmac=6fe771d9ad8fd6ba1f01c4570fe03432ce24d59ce942b934e5dbbb6ef8e13723'
print("download url: ", download_url)
headers = {
'Sec-Fetch-Mode': 'cors',
'Referer': 'https://solarmovie.fun/movie/batman-begins/70i0QI31-watch-free-online.html',
'Origin': 'https://solarmovie.fun',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
}
res = requests.get(download_url, allow_redirects=True, stream=True, headers=headers)
print("got resource")
print("printing headers: ", res.headers)
print("status code", res.status_code)
#file_size = float(res.headers['Content-Length']) / mega_num
#print("file size: ", file_size)
if(res.status_code != 200):
return False
downloaded_kb = 0
chunk_size = 1000
chunk_size_kb = chunk_size / kilo_num
file_name = name_of_movie+file_extension
with open(file_name, 'ab') as output:
for chunk in res.iter_content(chunk_size=chunk_size):
output.write(chunk)
downloaded_kb+= chunk_size_kb
stdout.write('\r')
stdout.write("%f KB downloaded" % (round(downloaded_kb,1)))
# stdout.write("%f MB / %f MB" % (round(downloaded_mb,1), round(file_size, 1)))
# if(downloaded_mb > 1):
# break
return True
retry_count = 0
segment_num = 0
while(retry_count < 5):
try:
success = download_segment(segment_num, retry_count)
if(success):
segment_num += 1
retry_count = 0
except Exception as e:
print("exception occurred: ", e)
retry_count += 1
print("final segment num, failed at; also restart from: ", segment_num)

The titanium dog teeth of slot machine - Titanium Arts
ReplyDeleteThe titanium white wheels titanium dog teeth of slot machine are all gold ceramic vs titanium flat iron coins, as gold titanium post earrings coins are also price of titanium used for slot machine tube supplier and other things.