Skip to content

Commit a38427f

Browse files
committed
update
1 parent b75bc19 commit a38427f

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

.gitconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.mp4
2+
*.log

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ NBA Recap Compiler is a simple script that scrapes the NBA homepage for .swf lin
44

55
## Getting Started
66

7-
All you need to do is run: ```python2.7 nbaRecapCompiler.py number_of_days_ago_you_want_highlights_from ```
7+
All you need to do is run: ```python2.7 nbaRecapCompiler.py <number_of_days_ago_you_want_highlights_from> ```
88

99
### Prerequisites
1010

@@ -19,3 +19,11 @@ All you need to do is run: ```python2.7 nbaRecapCompiler.py number_of_days_ago_y
1919

2020
* Thank you [youtube-dl](https://rg3.github.io/youtube-dl/)
2121
* Thank you [beautifulSoup](https://www.crummy.com/software/BeautifulSoup/)
22+
23+
24+
## Set up
25+
26+
`sudo pip install BeautifulSoup4 && sudo pip install selenium && sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && sudo chmod a+rx /usr/local/bin/youtube-dl && sudo pip install lxml && brew install ffmpeg`
27+
28+
Then install ChromeDriver: https://sites.google.com/a/chromium.org/chromedriver/downloads
29+

nbaRecapCompiler.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
from __future__ import unicode_literals
22
from bs4 import BeautifulSoup
33
from selenium import webdriver
4+
from selenium.webdriver.chrome.options import Options
45
from datetime import date, timedelta
56
from subprocess import call
67
import sys
78
import youtube_dl
89

910

1011
def soupify(url):
11-
driver = webdriver.Chrome()
12+
chrome_options = Options()
13+
# chrome_options.add_argument("--disable-extensions")
14+
# chrome_options.add_argument("--window-position=-0,0");
15+
# chrome_options.add_argument("--window-size=0,0")
16+
# driver.set_window_position(0, 0)
17+
# driver.set_window_size(0,0)
18+
chrome_options.add_argument("--headless")
19+
driver = webdriver.Chrome('/usr/local/bin/chromedriver', chrome_options=chrome_options)
1220
driver.get(url)
1321

1422
data = driver.page_source
@@ -53,6 +61,7 @@ def download_games(game_urls):
5361
print 'duration : %s' %(meta['duration'])
5462
print 'title : %s' %(meta['title'])
5563
print 'description : %s' %(meta['description'])
64+
print '-----------------------------------------'
5665
youtube_dl.YoutubeDL(ydl_opts).download(game_urls)
5766

5867

@@ -68,11 +77,7 @@ def download_games(game_urls):
6877
soup = soupify(url)
6978
game_urls = find_days_games(soup, date)
7079
download_games(game_urls)
71-
# try:
72-
# if sys.argv[2]:
73-
# print("All Done!")
74-
# except:
75-
# call('open *.mp4', shell=True)
80+
exit()
7681

7782

7883

0 commit comments

Comments
 (0)