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

Introduce medium importer #499

Merged
merged 9 commits into from
Dec 10, 2022
Merged

Introduce medium importer #499

merged 9 commits into from
Dec 10, 2022

Conversation

sumanmaity112
Copy link
Contributor

No description provided.

Copy link
Member

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. LGTM

docs/_importers/medium.md Outdated Show resolved Hide resolved
docs/_importers/medium.md Outdated Show resolved Hide resolved
lib/jekyll-import/importers/medium.rb Outdated Show resolved Hide resolved
@ashmaroli
Copy link
Member

Hello @sumanmaity112,
I am posting a generic comment about my observations instead of a review.

  • If you take a look at existing importers other than the RSS importer, you'll see that :specify_options definition has a pattern of aligning the various option parameters. I would like you to follow the same alignment style here as well. (In future, I may set up RuboCop to do this for contributors).
  • You have --canonical_link documented as false by default. But the :process method has it default to true. This needs to be addressed.
  • I find the description for --render_audio going over my head. What do you mean by enclosure URLs?
  • We have a Rake task to generate dependency metadata of importers for our docs site. You have to run bundle exec rake site:generate_dependency_data to update the data store for every new importer (and if dependencies for existing importers change). My apology for not having this step documented in our Contribution guide. In future, I plan to have Jekyll automate this for us.
  • With the above point in mind, if you choose to update to using Importers::RSS.require_deps as @parkr wondered, you have to run the above rake task once again to see if the task is able to register dependencies correctly. If not revert to the original API and update the list as needed.
  • I suggest using Importers::RSS.process in self.process instead of current RSS.process because it took me some time to realise that you were calling the RSS importer instead of the RSS library from the rss gem.
  • You have set extract_tags to invariably extract category field info from the RSS feed but have not documented that anywhere. Please leave a Ruby comment above the method for future reference for contributors and maintainers as to why this was done. Additionally, please document a tamer version of the same comment for end-user laymen so that they know what to expect.

@sumanmaity112
Copy link
Contributor Author

Hi @ashmaroli

  • I tried to update the importer_dependencies.yml using bundle exec rake site:generate_dependency_data but it started changing dependencies for other importer as well (without any of my changes). I am not sure if it's expected, so for now I manually updated the dependencies for Medium importer.

  • About the descriptions for --render_audio, it has the same descriptions as mentioned in RSS importer. Please let me know if I have to change it or not. If we want to change then I'll prefer to keep it sync with RSS importer as medium importer just pass the option value to RSS importer.

@parkr
Copy link
Member

parkr commented Nov 29, 2022

The render_audio documentation was something I asked to be like that. Before it was too vague. Perhaps now it's too specific. This option is basically only useful if you have a podcast RSS feed I think.

@sumanmaity112
Copy link
Contributor Author

The render_audio documentation was something I asked to be like that. Before it was too vague. Perhaps now it's too specific. This option is basically only useful if you have a podcast RSS feed I think.

Maybe, I am also not sure. This option was there before my changes in RSS importer.

"render_audio" => options.fetch("render_audio", false),
"canonical_link" => options.fetch("canonical_link", false),
# Add existing tags from Medium post to front matter using `category` subfield on the RSS <item>
"extract_tags" => "category",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why not support all of the RSS options? Should we just suggest to users on the docs page for Medium to use the RSS importer and show them how to use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why not support all of the RSS options?

If you see all the options from RSS importer is there except tag.

Should we just suggest to users on the docs page for Medium to use the RSS importer and show them how to use it?

It's possible but it'll be little verbose. Currently this Medium importer is just the wrapper for RSS importer.

def self.process(options)
Importers::RSS.process({
"source" => "https://medium.com/feed/@#{options.fetch("username")}",
"render_audio" => options.fetch("render_audio", false),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do Medium articles typically have audio?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Till now I haven't found any post with audio option. But if I am not wrong, it's possible to add video in medium post

@ashmaroli
Copy link
Member

Thank you for making the changes as suggested, @sumanmaity112. I have pushed a commit to your branch. Do run git pull origin master before you make additional changes to this proposal.

@ashmaroli
Copy link
Member

I have some enquiries remaining @sumanmaity112.

  • Is this importer done being developed? As in, if the RSS importer gets new options, how do we decide if those options need to be ported to the Medium Importer?
  • It is still not clear to me why you explicitly chose to extract the category field from the feed XML. The Ruby comment you have left needs some more love.
  • Ideally, we ask contributors to attach tests for pull requests. But given the state of the test-suite for this project, that will be overlooked. Can you instead attach a mock rss file based on your canonical site's export file? You may attach the mock file in the test directory.

@sumanmaity112
Copy link
Contributor Author

Hi @ashmaroli,

Is this importer done being developed? As in, if the RSS importer gets new options, how do we decide if those options need to be ported to the Medium Importer?

This is depends on the developer. If a new feature is getting added and same feature can be usable in case of Medium import then it's better to add it. According to me, we should have similar options set as RSS import. At the end, Medium import is nothing more than a wrapper around RSS importer with some default configurations.

It is still not clear to me why you explicitly chose to extract the category field from the feed XML. The Ruby comment you have left needs some more love.

I explained the comment little bit more, please do have a look.

Ideally, we ask contributors to attach tests for pull requests. But given the state of the test-suite for this project, that will be overlooked. Can you instead attach a mock rss file based on your canonical site's export file? You may attach the mock file in the test directory.

I added mock RSS feed file generated from my personal Medium feed (only with couple of items). Please let me know if I have to change anything there.

@parkr
Copy link
Member

parkr commented Dec 8, 2022

Needs a rebase to get @ashmaroli's latest commit to lock Psych to 4.x. I filed a request with ruby/setup-ruby: ruby/setup-ruby#412

@sumanmaity112
Copy link
Contributor Author

@parkr Rebase is done. Now all CI verification also passed.

@parkr
Copy link
Member

parkr commented Dec 10, 2022

Thank you!

@jekyllbot: merge +minor

@jekyllbot jekyllbot merged commit a34ac70 into jekyll:master Dec 10, 2022
jekyllbot added a commit that referenced this pull request Dec 10, 2022
github-actions bot pushed a commit that referenced this pull request Dec 10, 2022
Suman Maity: Introduce medium importer (#499)

Merge pull request 499
@jekyll jekyll locked and limited conversation to collaborators Dec 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants