freiheit / discord_feedbot

Moved to https://gitlab.com/ffreiheit/discord_feedbot
MIT License
81 stars 28 forks source link

"fields = dc:creator" not working #34

Closed OfotViking closed 7 years ago

OfotViking commented 7 years ago

ERROR:main:process_field:dc:creator:no such field

source: http://twitrss.me/

My config:

[twitter]
channels = general
feed_url = http://twitrss.me/twitter_user_to_rss/?user=twitter
fields = **dc:creator**,description,link
max_age = 3600

Can't see if it is a re-tweet or not

freiheit commented 7 years ago

TL;DR: Try author instead of dc:creator for the field.

I added a tool to help with debugging this kind of thing in the future. "show_sample_entry.py".

It pulls a feed URL, parses it, and shows the parsed data for the first entry in the feed.

For that feed I get:

{   'author': 'Twitter (@twitter)',
    'author_detail': {...},
    'authors': [...],
    'guidislink': True,
    'id': 'https://twitter.com/twitter/status/785903425451982848',
    'link': 'https://twitter.com/twitter/status/785903425451982848',
    'links': [...],
    'published': 'Tue, 11 Oct 2016 19:02:32 +0100',
    'published_parsed': time.struct_time(tm_year=2016, tm_mon=10, tm_mday=11, tm_hour=18, tm_min=2, tm_sec=32, tm_wday=1, tm_yday=285, tm_isdst=0),
    'summary': '<p class="TweetTextSize TweetTextSize--26px js-tweet-text '
               # [... removed for length ...]
               'width="250" />',
    'summary_detail': {...},
    'title': '+  = #TravelTuesday\n'
             ' https://twitter.com/i/moments/785873728018214912\xa0'
             '…pic.twitter.com/Ss4QEQZoI5',
    'title_detail': {...},
    'twitter_place': '',
    'twitter_source': ''}

The feedparser library handles some field specially. Looks like "dc:creator" gets automatically changed to "author" and also parsed into a more complicated data structure (that we can't use yet).