Skip to content

Instantly share code, notes, and snippets.

View lowweihong's full-sized avatar

Low Wei Hong lowweihong

View GitHub Profile
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
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',
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
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',
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]:
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')
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')
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):
"""
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
gauth = GoogleAuth()
# Try to load saved client credentials