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

Railsconf 2023 videos #43

Merged

Conversation

PedroAugustoRamalhoDuarte
Copy link
Contributor

@PedroAugustoRamalhoDuarte PedroAugustoRamalhoDuarte commented Jul 17, 2023

First of all thanks for the project, it was so easy to setup.

This PRs adds rails conf 2023 videos, it still work on progress, and i am developing a better parser.

require "json"
require "yaml"

# This scripts get the json file from youtube api and parser to yaml file in rubyvideo format
# This scripts does not handle well:
# - Keynotes
# - Multiples speakers that are not separated by ","


# Get JSON File from: https://developers.google.com/youtube/v3/docs/playlistItems/list
json = File.read("./test.json")
playlist = JSON.parse(json)

videos = playlist["items"].map do |video|

  # Handle speakers
  speakers = video["snippet"]["title"].split("by")[-1]
  speakers = speakers.split(",").map(&:strip).map do |speaker|
    speaker
  end

  raw_title = video["snippet"]["title"]

  {
    "title" => raw_title.split(" by ")[0].gsub("RailsConf 2023 -", "").strip,
    "raw_title" => raw_title,
    "speakers" => speakers,
    "description" => video["snippet"]["description"],
    "thumbnail_xs" => video["snippet"]["thumbnails"]["default"]["url"],
    "thumbnail_sm" => video["snippet"]["thumbnails"]["medium"]["url"],
    "thumbnail_md" => video["snippet"]["thumbnails"]["high"]["url"],
    "thumbnail_lg" => video["snippet"]["thumbnails"]["standard"]["url"],
    "thumbnail_xl" => video["snippet"]["thumbnails"]["maxres"]["url"],
    "published_at" => video["snippet"]["publishedAt"].split("T")[0],
    "video_id" => video["snippet"]["resourceId"]["videoId"]
  }
end

pp videos.length

yaml_output = videos.to_yaml

# Write YAML to a file
File.open('output.yaml', 'w') { |file| file.write(yaml_output) }

@adrienpoly
Copy link
Owner

Thanks for your work I am late cleaning up and publishing my scripts I used for the initial batch. Hope to get this done by the end of the week. Anyway that won't prevent us to move forward with RailsConf23 vids

If you want to bring it to the finish line before that here are a few things to correct:

  • remove "RailsConf 2023 -" from the title. This is very repetitive and information we already have displayed on the card (event name). Except when it is a keynote as the keynote usually doesn't have a full title so here I feel it makes sense to key the RailsConf23 in the title
  • remove the speakers from the title. Given this raw title RailsConf 2023 - 10x your teamwork through pair programming by Michael Milewski, Selena Small expected title is 10x your teamwork through pair programming
  • manually check the speaker for the keynotes. usually, the pattern for keynotes is different from other titles and the speakers are not always well extracted. Here Aaron is not well extracted as an example

thanks again for taking this task!

@PedroAugustoRamalhoDuarte
Copy link
Contributor Author

Thanks for the feedback @adrienpoly !!

@PedroAugustoRamalhoDuarte PedroAugustoRamalhoDuarte changed the title [DRAFT] Railsconf 2023 videos Railsconf 2023 videos Jul 18, 2023
@PedroAugustoRamalhoDuarte
Copy link
Contributor Author

@adrienpoly i have fixed the title, manually fixed some speakears and add the last videos.

adrienpoly and others added 7 commits July 18, 2023 15:56
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
Co-authored-by: Marco Roth <marco.roth@intergga.ch>
@adrienpoly adrienpoly merged commit c26e41f into adrienpoly:main Jul 20, 2023
2 of 3 checks passed
@adrienpoly
Copy link
Owner

Thanks @PedroAugustoRamalhoDuarte and @marcoroth I merged it and discovered a few things to fix that I pushed to main. Will try to deploy it this afternoon.

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