summaryrefslogtreecommitdiff
path: root/bin/parse_subids.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/parse_subids.py')
-rw-r--r--bin/parse_subids.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/parse_subids.py b/bin/parse_subids.py
new file mode 100644
index 0000000..5e8b8f2
--- /dev/null
+++ b/bin/parse_subids.py
@@ -0,0 +1,19 @@
+from bs4 import BeautifulSoup
+import markdown
+
+
+with open('/home/lxf/writing/wired/bf-photo-deals.txt', 'r') as f:
+ data = f.read()
+result = open('/home/lxf/writing/wired/subid-links.txt', 'a')
+soup = BeautifulSoup(markdown.markdown(data), "lxml")
+subid = "blackfridayphotodeals2019"
+page_url = "https://www.wired.com/story/best-black-friday-photography-deals-2019/"
+for a in soup.find_all('a'):
+ start = a['href'].split('//')[1][:4]
+ if str(start) == 'best' or start == 'goto':
+ l = "%s,,%s,Impact,%s\n" % (page_url, subid, a['href'])
+ result.write(l)
+result.close()
+
+def parse_links(f):
+