This file contains 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 lxml import html | |
from selenium import webdriver | |
# scrape from mixlr page after js done (element won't exist otherwise) | |
driver = webdriver.PhantomJS(executable_path='<replace path>/phantomjs.exe') # another webdriver works fine | |
driver.get('http://mixlr.com/<replace username>') | |
tree = html.fromstring(driver.page_source) | |
air_status = tree.xpath('//*[@id="broadcaster_status"]/span[2]//text()') | |
driver.quit() |
This file contains 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 lxml import html | |
import requests | |
#scrape periscope desktop page; meta tag token-id content is empty when not streaming | |
page = requests.get('https://www.periscope.tv/<replace username>') | |
tree = html.fromstring(page.content) | |
air_status = tree.xpath('//*[@id="token-id"]/@content') |
This file contains 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 twitch.api.v3 import streams | |
# check stream w/twitch api https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel | |
check = streams.by_channel('<replace channel name>') | |
# if stream None (not live) then type == dict is False (otherwise True when live) | |
air_status = type(check['stream']) == dict |
This file contains 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
cd $OPENSHIFT_DATA_DIR | |
echo "Comparing/Updating main_post table in db to sync production to local" | |
./sqldiff db.sqlite3 $OPENSHIFT_REPO_DIR/data/db.sqlite3 --table main_post > update_db.sql | |
sqlite3 db.sqlite3 < update_db.sql |