Closed hanscees closed 11 months ago
Here is an example:
from feedgen.feed import FeedGenerator
feed = FeedGenerator()
feed.load_extension('media')
feed.id('https://www.bomengids.nl/mastodon-homefeed-rss') #give the id you want this rss feed to be for
feed.link( href='http://example.com', rel='alternate' )
feed.title('mastodon (re)-posts')
feed.description('some description')
item = feed.add_entry()
item.title('Some title')
item.link(href="http://example.com")
item.id('https://example.com/123')
item.media.content({"url" : 'https://example.com/123.mp4', "type": 'video/mp4'})
This will produce a feed like this:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns:media="http://search.yahoo.com/mrss/" xmlns="http://www.w3.org/2005/Atom">
<id>https://www.bomengids.nl/mastodon-homefeed-rss</id>
<title>mastodon (re)-posts</title>
<updated>2023-12-22T10:07:43.804102+00:00</updated>
<link href="http://example.com" rel="alternate"/>
<generator uri="https://lkiesow.github.io/python-feedgen" version="0.9.0">python-feedgen</generator>
<subtitle>some description</subtitle>
<entry>
<id>https://example.com/123</id>
<title>Some title</title>
<updated>2023-12-22T10:07:43.804579+00:00</updated>
<link href="http://example.com"/>
<media:group>
<media:content url="https://example.com/123.mp4" type="video/mp4"/>
</media:group>
</entry>
</feed>
Hi, I've been trying for hours but nothing I do succesfully loads the media example
My code is essentially:
feed = FeedGenerator() feed.load_extension('media') feed.id('https://www.bomengids.nl/mastodon-homefeed-rss') #give the id you want this rss feed to be for feed.title('mastodon (re)-posts') statuses = enriched_list for status in statuses: created = status['published'] item = feed.add_entry() item.id(url) item.media.media_content({"url" : media_url, "type": mediatype})
it then says: item.media.media_content({"url" : media_url, "type": mediatype}) AttributeError: 'MediaEntryExtension' object has no attribute 'media_content'
What am I doing wrong?