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

[SUGGESTION] A $videoid variable for the template property #28

Closed
ghost opened this issue Sep 20, 2020 · 14 comments
Closed

[SUGGESTION] A $videoid variable for the template property #28

ghost opened this issue Sep 20, 2020 · 14 comments
Labels
enhancement New feature or request help wanted Extra attention is needed up-for-grabs

Comments

@ghost
Copy link

ghost commented Sep 20, 2020

This could be used to, for example, display the thumbnail of the video directly on the readme.md file, or can be used to get additional data about that video from youtube itself. Just a little thought I had while customizing my readme.md file with this.

@gautamkrishnar
Copy link
Owner

gautamkrishnar commented Sep 20, 2020

@ConstantinDev including videoId as a parameter will go beyond the scope of this project. This project focuses on feed list gneration, i am not planning to include platform specific options other than the built in filters.

But i think adding a custom_tags argument that allows you to get the tags you are looking for on your template will be a good option.

Eg this is a youtube feed item:

<entry>
<id>yt:video:DPnJldwv22o</id>
<yt:videoId>DPnJldwv22o</yt:videoId>
<yt:channelId>UCDCHcqyeQgJ-jVSd6VJkbCw</yt:channelId>
<title>FREE Icons! How to use Bootstrap Icons v1.0.0 | Bootstrap 5 (2020)</title>
<link rel="alternate" href="https://www.youtube.com/watch?v=DPnJldwv22o"/>
<author>
<name>codeSTACKr</name>
<uri>https://www.youtube.com/channel/UCDCHcqyeQgJ-jVSd6VJkbCw</uri>
</author>
<published>2020-09-05T14:00:02+00:00</published>
<updated>2020-09-07T16:48:52+00:00</updated>
<media:group>
<media:title>FREE Icons! How to use Bootstrap Icons v1.0.0 | Bootstrap 5 (2020)</media:title>
<media:content url="https://www.youtube.com/v/DPnJldwv22o?version=3" type="application/x-shockwave-flash" width="640" height="390"/>
<media:thumbnail url="https://i1.ytimg.com/vi/DPnJldwv22o/hqdefault.jpg" width="480" height="360"/>
<media:description>👉 Sign up for my newsletter to stay up-to-date on my new course: https://codestackr.com Did you know that Bootstrap has its own icon library? Apparently, they released the first stable version, 1.0.0, last week. In this video, we'll look at how we can implement these with any of our projects even if we are not using Bootstrap. That's right! You can use these independent of Bootstrap. Bootstrap 5 is not required. Since these are MIT licensed and they are just SVGs, we can use them anywhere for FREE! Let me know what you think. Website: https://icons.getbootstrap.com/ Timestamps: 00:00 - Introduction 00:34 - Installation 01:34 - Embedding 03:07 - Sprite 04:34 - External Image 06:26 - CSS 08:32 - Style _____________________________________ 💖 Show support! PayPal: https://paypal.me/codeSTACKr _____________________________________ Watch Next: Web Development - Beginners Roadmap (2020) - https://youtu.be/iogabydg2y0 Playlist: Web Development For Beginners - https://www.youtube.com/watch?v=Ez4yHS2dsN8&list=PLkwxH9e_vrAJ0WbEsFA9W3I1W-g_BTsbt _____________________________________ Connect With Me: Website: http://www.codestackr.com Twitter: https://twitter.com/codeSTACKr Instagram: https://instagram.com/codeSTACKr Facebook: https://facebook.com/codeSTACKr _____________________________________ ** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you. #codeSTACKr #bootstrap5 #icons</media:description>
<media:community>
<media:starRating count="346" average="4.95" min="1" max="5"/>
<media:statistics views="6093"/>
</media:community>
</media:group>
</entry>

You can pass custom_tags: videoId/yt:videoId/,channelId/yt:channelId/ this will give you yt:channelId as $channelId and yt:videoId as $videoId in the template.

This feature is not available yet.

@gautamkrishnar gautamkrishnar added enhancement New feature or request help wanted Extra attention is needed up-for-grabs labels Sep 20, 2020
@gautamkrishnar
Copy link
Owner

I will work on this when i have time. Lets keep this issue open so that someone else can pick it up if they are interested.

@gautamkrishnar
Copy link
Owner

gautamkrishnar commented Sep 21, 2020

Just completed this feature now you will be able to use the custom tags as follows:
Lets say you have the following feed entry:

<entry>
<id>yt:video:DPnJldwv22o</id>
<yt:videoId>DPnJldwv22o</yt:videoId>
<yt:channelId>UCDCHcqyeQgJ-jVSd6VJkbCw</yt:channelId>
<title>FREE Icons! How to use Bootstrap Icons v1.0.0 | Bootstrap 5 (2020)</title>
<link rel="alternate" href="https://www.youtube.com/watch?v=DPnJldwv22o"/>
<author>
<name>codeSTACKr</name>
<uri>https://www.youtube.com/channel/UCDCHcqyeQgJ-jVSd6VJkbCw</uri>
</author>
<published>2020-09-05T14:00:02+00:00</published>
<updated>2020-09-07T16:48:52+00:00</updated>
<media:group>
<media:title>FREE Icons! How to use Bootstrap Icons v1.0.0 | Bootstrap 5 (2020)</media:title>
<media:content url="https://www.youtube.com/v/DPnJldwv22o?version=3" type="application/x-shockwave-flash" width="640" height="390"/>
<media:thumbnail url="https://i1.ytimg.com/vi/DPnJldwv22o/hqdefault.jpg" width="480" height="360"/>
<media:description>👉 Sign up for my newsletter to stay up-to-date on my new course: https://codestackr.com Did you know that Bootstrap has its own icon library? Apparently, they released the first stable version, 1.0.0, last week. In this video, we'll look at how we can implement these with any of our projects even if we are not using Bootstrap. That's right! You can use these independent of Bootstrap. Bootstrap 5 is not required. Since these are MIT licensed and they are just SVGs, we can use them anywhere for FREE! Let me know what you think. Website: https://icons.getbootstrap.com/ Timestamps: 00:00 - Introduction 00:34 - Installation 01:34 - Embedding 03:07 - Sprite 04:34 - External Image 06:26 - CSS 08:32 - Style _____________________________________ 💖 Show support! PayPal: https://paypal.me/codeSTACKr _____________________________________ Watch Next: Web Development - Beginners Roadmap (2020) - https://youtu.be/iogabydg2y0 Playlist: Web Development For Beginners - https://www.youtube.com/watch?v=Ez4yHS2dsN8&list=PLkwxH9e_vrAJ0WbEsFA9W3I1W-g_BTsbt _____________________________________ Connect With Me: Website: http://www.codestackr.com Twitter: https://twitter.com/codeSTACKr Instagram: https://instagram.com/codeSTACKr Facebook: https://facebook.com/codeSTACKr _____________________________________ ** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you. #codeSTACKr #bootstrap5 #icons</media:description>
<media:community>
<media:starRating count="346" average="4.95" min="1" max="5"/>
<media:statistics views="6093"/>
</media:community>
</media:group>
</entry>

Use the following code To get yt:channelId and yt:videoId in the template as channelId and videoId respectively:

name: Latest blog post workflow
on:
  schedule: # Run workflow automatically
    - cron: '0 * * * *' # Runs every hour, on the hour
  workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly
jobs:
  update-readme-with-blog:
    name: Update this repo's README with latest blog posts
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: gautamkrishnar/blog-post-workflow@master
        with:
          feed_list: "https://example.com/feeds"
          custom_tags: "channelId/yt:channelId/,videoId/yt:videoId/"
          template: [$title]($url) $channelId $videoId

@DenverCoder1
Copy link
Contributor

Thanks @gautamkrishnar! I was about to open an issue, but I'm glad I checked here because this is exactly what I was looking for.

@kristofzerbe
Copy link

Hi @gautamkrishnar ... this feature helps a lot, but one question: How do I reference a property of a tag, for example media:thumbnail > url?

@gautamkrishnar
Copy link
Owner

gautamkrishnar commented Jan 30, 2022

@kristofzerbe can you share an RSS feed example for the same?

@kristofzerbe
Copy link

Take your example in your comment from Sep, 21 2020. There you have a tag <media:thumbnail url="https://i1.ytimg.com/vi/DPnJldwv22o/hqdefault.jpg" width="480" height="360"/>. My feed has exactly the same tag and I want to use the url property.

@gautamkrishnar
Copy link
Owner

@kristofzerbe right now there isn't any API to do that. if you are trying to include the youtube video's thumbnail I recommend you to use the youtube API. Get the video ID using the above example and use the following API to return the image:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg

Example: https://img.youtube.com/vi/DPnJldwv22o/hqdefault.jpg

You can use the above in combination with the templates to generate a table. You can refer this as an example: https://github.com/Dexters-Hub/Dexters-Hub/blob/master/.github/workflows/youtube-workflow.yml

@kristofzerbe
Copy link

@gautamkrishnar ... hhmm, I don't understand you answer yet. Let me explain my thoughts:

You have implemented custom_tags for getting the content of a tag inside an entry of a feed. Like yt:channelId in your example.

But there are other tags in the feed, which carry their information not in the content, but in a named property, like <media:thumbnail url="" /> or <media:starRating count="" />.

My question is now, how do I get the value of those properties, for example count in the tag media:starRating?

@gautamkrishnar
Copy link
Owner

gautamkrishnar commented Jan 30, 2022

@kristofzerbe as I mentioned earlier. It is not supported. You can only access values that are wrapped by a tag. Example:

<yt:channelId>UCDCHcqyeQgJ-jVSd6VJkbCw</yt:channelId>

You cant access the named properties of tags.

@kristofzerbe
Copy link

Do you see any chance to handle my question as a feature request?

@gautamkrishnar
Copy link
Owner

@kristofzerbe sorry, unfortunately as far as I know the library i am using to parse the rss feeds do not support that. That's why I am unable to implement that as a feature. This is a non standard use case btw.

@kristofzerbe
Copy link

Hi @gautamkrishnar ... You are right. RSS-Parser doesn't provide attributes of entry tags yet. I have created a pull request to achieve that ... see rbren/rss-parser#224

With this change users of blog-post-workflow should be able to write custom_tags: "mediaThumbnailUrl/media:thumbnail.url/", to get the value of url out the tag media:thumbnail into the field mediaThumbnailUrl, if you decide to use this changed version.

@gautamkrishnar
Copy link
Owner

@kristofzerbe That's great. Will upgrade once they merge it. 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed up-for-grabs
Projects
None yet
Development

No branches or pull requests

3 participants