Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Retrieving and Testing streaming data #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Retrieval/Streamlink/ffm_reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import subprocess
#import ffmpy
import sys, os
import time

fileName = "TW-FFMPEG.txt"
time_start = time.time();
i = 0
with open(fileName,"r") as fp:
for line in fp:
i = i + 1
line = fp.readline()
print(line)
print("ffmpeg -i " + line.rstrip() + " -t 5 taiwan_images.png")
subprocess.call("ffmpeg -i " + line.rstrip() + " -vf fps=1 -framerate 1 -t 5 taiwan_images" + str(i) + "%d.png", shell=True)

time_cur = time.time()

print(time_cur - time_start)
54 changes: 54 additions & 0 deletions Retrieval/Streamlink/loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

"""
--------------------------------------------------------------------------------
Descriptive Name : loop.py
Author : Minghao Guo (Mina)
Contact Info : [email protected]
Date Written : June 22, 2017
Description : Used for looping through all the earthcamURLs and transferred them into m3u8 urls by using fetchstreamsrc.py
Command to run script: python3 loop.py
Usage : Can be imported into another script or run from the command line
Input file format : N/A
Output : A list of m3u8 urls
Note : This is only the initial script for getting all the m3u8 urls, it will stuck everytime it encounters an url of RTMP type, so I had to run fetchstreamsrc.py manually to get the information of those urls with issues. The next step is to identify the urls of RTMP type and deal with them specifically.
Other files required by : fetchstreamsrc.py (written by Caleb)
this script and where
located
--------------------------------------------------------------------------------
"""

import streamlink
from bs4 import BeautifulSoup
from fetchstreamsrc import get_stream_src_from_url
import re
import sys
import string
import traceback
import logging
#from urllib.parse import urlparse
#url_type = urlparse(http://www.earthcam.com/usa/colorado/breckenridge/)
#read lines from earthcamURL

#read lines from earthcamURL

with open('earthcamURL.txt') as f:
page_url = []
page_url = f.readlines()
#loop through every line in the list
for line in page_url:
#parse the type of urls
#url_type = urlparse(line.rstrip())
#print(url_type)
#scheme = url_type.scheme
#print(scheme)
#transform the original urls into m3u8 ones using the function in fetchstreamsrc.py
try:
src_url = get_stream_src_from_url(line.rstrip())
#print(src_url)
except Exception as e:
#logging.error(traceback.format_exc())
pass
print(src_url)
#continue
#print(src_url)
#print("m3u8 url: %s", src_url)