forked from WenhaoDaiCN/Panda-Learning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: alivon <[email protected]>
- Loading branch information
alivon
committed
Apr 12, 2019
1 parent
e862e79
commit 0e6e849
Showing
6 changed files
with
93 additions
and
69 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import requests | ||
import re | ||
|
||
|
||
def get_article_links(): | ||
article = requests.get( | ||
"https://www.xuexi.cn/c06bf4acc7eef6ef0a560328938b5771/data9a3668c13f6e303932b5e0e100fc248b.js").content.decode( | ||
"utf8") | ||
pattern = r"list\"\:(.+),\"count\"\:" | ||
links = [] | ||
list = eval(re.search(pattern, article).group(1))[:20000] | ||
list.reverse() | ||
for i in range(len(list)): | ||
links.append(list[i]["static_page_url"]) | ||
return links | ||
try: | ||
article = requests.get( | ||
"https://www.xuexi.cn/c06bf4acc7eef6ef0a560328938b5771/data9a3668c13f6e303932b5e0e100fc248b.js").content.decode( | ||
"utf8") | ||
pattern = r"list\"\:(.+),\"count\"\:" | ||
links = [] | ||
list = eval(re.search(pattern, article).group(1))[:20000] | ||
list.reverse() | ||
for i in range(len(list)): | ||
links.append(list[i]["static_page_url"]) | ||
return links | ||
except: | ||
print("=" * 120) | ||
print("get_article_links获取失败") | ||
print("=" * 120) | ||
raise | ||
|
||
|
||
def get_video_links(): | ||
video = requests.get( | ||
"https://www.xuexi.cn/4426aa87b0b64ac671c96379a3a8bd26/datadb086044562a57b441c24f2af1c8e101.js").content.decode( | ||
"utf8") | ||
pattern = r'https://www.xuexi.cn/[^,"]*html' | ||
link = re.findall(pattern, video, re.I) | ||
link.reverse() | ||
return link | ||
|
||
|
||
try: | ||
video = requests.get( | ||
"https://www.xuexi.cn/4426aa87b0b64ac671c96379a3a8bd26/datadb086044562a57b441c24f2af1c8e101.js").content.decode( | ||
"utf8") | ||
pattern = r'https://www.xuexi.cn/[^,"]*html' | ||
link = re.findall(pattern, video, re.I) | ||
link.reverse() | ||
return link | ||
except: | ||
print("=" * 120) | ||
print("get_video_links获取失败") | ||
print("=" * 120) | ||
raise |
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
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.