Commit 883c2afb authored by Niklas Ulfvarson's avatar Niklas Ulfvarson
Browse files

Better parsing and debug msgs

parent bec408ff
......@@ -35,9 +35,9 @@ if post_date != last_date:
lst = lst.replace('Ö', 'Ö')
lst = lst.replace('&', '&')
lst = lst.replace(' ', '')
lst = lst.replace('<p><strong>Fredag ', '')
lst = lst.replace('<p>', '')
lst = lst.replace('</p>', '')
lst = lst.replace('&ndash;', '-')
lst = lst.replace('<strong>Fredag ', '')
lst = re.sub(r'<.?p.*?>', '', lst)
## Split different companies to separate messages
## Necessary as telegram msg must be < 4096
......@@ -51,7 +51,9 @@ if post_date != last_date:
for i in range(1, int(((len(lst_split)-1)/2))):
lst_msg = lst_split[2*i-1]+lst_split[2*i]
data = {'chat_id': '@Rymdjobb', 'disable_web_page_preview': 'True', 'disable_notification': 'True', 'parse_mode': 'html', 'text': lst_msg}
requests.post(turl, data).json()
r = requests.post(turl, data).json()
if not r['ok']:
print('Message failed! Response: ' + r)
## Save this date in a file, as to not send the same listings twice
df = open('datefile.txt', 'w+')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment