Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds youtube template #127

Merged
merged 1 commit into from
Jan 18, 2024
Merged

Adds youtube template #127

merged 1 commit into from
Jan 18, 2024

Conversation

faan11
Copy link
Contributor

@faan11 faan11 commented Jan 14, 2024

Hi,

As the title suggested, this pull request adds a new template to handle channel video feeds coming from YouTube.

These feeds can be obtained with the following URL format:
https://www.youtube.com/feeds/videos.xml?channel_id=${CHANNEL_ID}
CHANNEL_ID can be retrieved in the channel URL ( for instance: https://www.youtube.com/channel/${CHANNEL_ID} ) .

The email template provides the video information such as the published date, the author and the description. The description has been obtained by looking at the fields that were not parsed by the default parser of gofeed, in the Extensions attribute.

Feel free to share any suggestions, input or concerns you may have

Thank you,
Fabio

@StayPirate
Copy link
Contributor

Nice one, it would be handy to have a template to easily use for youtube channels. Thanks for having shared it 👍🏼

@skx
Copy link
Owner

skx commented Jan 16, 2024

I'm not sure what to do with this, because on the one hand it's an awesome thing to see, but on the other if it were merged it would probably get ignored when changes were made to the "main" template.

I think the best approach might be to move it into a new directory:

  • example_templates/
    • Add it there "youtube.tmpl", along with a README.md showing how to use a custom template on a per-feed basis.

I'd be happy to write a README, and update the main README if you moved it there. Does that sound reasonable?

@StayPirate
Copy link
Contributor

Could you confirm that we could then simply use it by specifying it as follow?

http://....feed
- template: /example_templates/youtube.tmpl

Or would be required to manually move youtube.tmpl into the /templates folder?

@skx
Copy link
Owner

skx commented Jan 16, 2024

Yes, just specify the path to the local file, as you did there.

It doesn't need to be in templates, it just needs to exist somewhere on the users's system, and the path specified beneath the feed.

The only magic otherwise is that template/template.txtis included as an embedded file within our binary, but that is the only file included. Other files you might place beneath template are not included in the binary.

@StayPirate
Copy link
Contributor

what do you mean with "included as an embedded file within our binary"? Does template/template.txt gets somehow copied within the static binary output by the go-compiler?

I use rss2email via its official docker image, can I expect to find /example_templates/youtube.tmpl available in the container once this PR will be merged?

@skx
Copy link
Owner

skx commented Jan 16, 2024

what do you mean with "included as an embedded file within our binary"? Does template/template.txt gets somehow copied within the static binary output by the go-compiler?

Yes. Via this line in template/template.go:

//go:embed template.txt

That's how rss2email export-default-template is able to output the default template, to allow edits to be applied locally - as described in the README.md file.

I use rss2email via its official docker image, can I expect to find /example_templates/youtube.tmpl available in the container once this PR will be merged?

No. The container will only contain /usr/local/bin/rss2email. It is assumed that the users of that dockerfile will bind-mount a config file (containing their feed sources), and perhaps the state directory. If you wish to use docker with the default image you also need to add your own template, or handle it with the bind-mounted directory.

(Personally I bind-mount "rss2email.state" to "/app/.rss2email" so I can ensure the container has:

  • My feed list.
  • The state stored outside the container.
  • Local templates I've added for specific feeds - kinda like your youtube example.

@faan11
Copy link
Contributor Author

faan11 commented Jan 16, 2024

I'm not sure what to do with this, because on the one hand it's an awesome thing to see, but on the other if it were merged it would probably get ignored when changes were made to the "main" template.

I think the best approach might be to move it into a new directory:

* `example_templates/`
  
  * Add it there "youtube.tmpl", along with a README.md showing how to use a custom template on a per-feed basis.

I'd be happy to write a README, and update the main README if you moved it there. Does that sound reasonable?

In my opinion, it sounds good. I'll create a folder example_template in the root of the project.This folder holds the template along with a README.md that explains how to proper download the template and use it with the youtube feeds.

@faan11
Copy link
Contributor Author

faan11 commented Jan 16, 2024

Hi @skx,

I've successfully created the folder and crafted the README.md according to the provided specifications. Could you please review it and confirm if everything aligns with your expectations?

Once approved, I'll proceed with consolidating all the commits into a single, clean commit.

Thank you for your time and feedback!

Best regards,
Fabio

@skx
Copy link
Owner

skx commented Jan 17, 2024

I would probably reword some things, but yeah that looks like a great start and I'd be happy to merge it.

@skx skx self-requested a review January 17, 2024 18:51
Adds a new example template folder. In this folder, you'll find the
README that describes the purpose of this folder along with the
description of youtube.txt template.
The template.txt is the youtube template used to retrieve video channel feeds.
@faan11
Copy link
Contributor Author

faan11 commented Jan 17, 2024

Hi @skx

Thank you for your patience. I have merged all the commit into one. You can proceed by merging the code in the codebase.
Feel free to adjust the README as you prefer to improve readability and add also other detail that i may forgot.
I'll create a new pull request whether I figure out how to retrieve additional fields,

Thank you again,
Best regards,
Fabio

@skx skx merged commit a328a02 into skx:master Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants