This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
00:01:18,287 --> 00:01:22,212 | |
<i>Get ready for the feel, | |
the feel of real. X1 .</i> | |
2 | |
00:01:22,374 --> 00:01:24,126 | |
<i>No pain, no gain.</i> | |
3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from websocket import create_connection | |
import json | |
# Copy the web brower header and input as a dictionary | |
headers = json.dumps({ | |
'Pragma': 'no-cache', | |
'Origin': 'https://www.cryptocompare.com', | |
'Accept-Language': 'en-US,en;q=0.9', | |
'Sec-WebSocket-Key': 'QknTzkhVwUs8UY+xAE22Kg==', | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import feedparser | |
from pprint import pprint | |
from bs4 import BeautifulSoup | |
url = "http://news.google.com/news?q=covid-19&hl=en-US&sort=date&gl=US&num=100&output=rss" | |
class ParseFeed(): | |
def __init__(self, url): | |
self.feed_url = url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from websocket import create_connection | |
import json | |
# Copy the web brower header and input as a dictionary | |
headers = json.dumps({ | |
'Accept-Encoding': 'gzip, deflate, br', | |
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8', | |
'Cache-Control': 'no-cache', | |
'Connection': 'Upgrade', | |
'Host': 'streamer.cryptocompare.com', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from html.parser import HTMLParser | |
class MyHTMLParser(HTMLParser): | |
links = [] | |
def handle_starttag(self, tag, attrs): | |
if tag != 'a': | |
return | |
for attr in attrs: | |
if 'href' in attr[0]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lxml.html | |
dom = lxml.html.fromstring(r.text) | |
for node_link in dom.cssselect('tr > td:nth-child(2) > a:nth-child(3)'): | |
url = node_link.get('href') # OR node_link.attrib['href'] | |
# check whether the url is downloadable | |
if is_downloadable(url): | |
wget.download(url, './data/' + url.split('&file=')[-1].split('&format')[0] + '.mid') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import wget | |
soup = BeautifulSoup(r.text, 'lxml') | |
for node_link in soup.select('tr > td:nth-child(2) > a:nth-child(3)'): | |
url = node_link['href'] | |
if is_downloadable(url): | |
wget.download(url, | |
'./data/' + url.split('&file=')[-1].split('&format')[0] + '.mid') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydrive.auth import GoogleAuth | |
from pydrive.drive import GoogleDrive | |
import requests | |
import pandas as pd | |
from datetime import datetime, timedelta | |
from bs4 import BeautifulSoup | |
import os | |
def create_folder(drive, folder_name, parent_folder_id): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydrive.auth import GoogleAuth | |
from pydrive.drive import GoogleDrive | |
import requests | |
import pandas as pd | |
from datetime import datetime, timedelta | |
from bs4 import BeautifulSoup | |
import os | |
# Downloading today data from SGX using SGX API | |
today = datetime.now() |
NewerOlder