Slide 1

Slide 1 text

How to use Golang download YouTube video LINE Developer Relations Evan Lin 2020.05 1

Slide 2

Slide 2 text

Evan Lin • Google Developer Expert • LINE Developer Meetup • LINE TAIWAN TECHPULSE Organizer LINE Technology Evangelist 2

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

How to get Youtube Video Info? https://www.youtube.com/watch?v=rFejpH_tAHM https://youtube.com/get_video_info?video_id=rFejpH_tAHM 4

Slide 5

Slide 5 text

How to get Youtube Video Info? 5

Slide 6

Slide 6 text

RAW Data 6

Slide 7

Slide 7 text

How to parse with Query Parameter 7

Slide 8

Slide 8 text

Get Video Author and Title How to handle JSON value without structure data. 8

Slide 9

Slide 9 text

Let’s find the video download link 9

Slide 10

Slide 10 text

How to process JSON data from Web Jsonlint.com à Paste and copy on text editor à Json to Go 10

Slide 11

Slide 11 text

Using the file download link… 11

Slide 12

Slide 12 text

Using the file download link… (what?) No url??? But new ”cipher”? 12

Slide 13

Slide 13 text

Finally … https://stackoverflow.com /questions/60607291/you tube-video-downloader- with-php 13

Slide 14

Slide 14 text

Look into browser player related setting https://www.youtube.com/embed/FHpvI8oGsuQ?hl=en https://www.youtube.com/s/player/e3cd195e/player_ias.vflset/en_US/base.js 14

Slide 15

Slide 15 text

Make it simple … “string” EQ(“string”, 3) è c = ‘s’ è a[0] = a[2] = `r` è a[2] = `s` à “rtsing” 15

Slide 16

Slide 16 text

Decipher :Operation 16

Slide 17

Slide 17 text

Decipher : Parse Ops and Args https://github.com/kkdai/youtube/blob/master/decipher.go#L12 17

Slide 18

Slide 18 text

Looking for contributors 18 https://github.com/kkdai/youtube

Slide 19

Slide 19 text

LINE TECH FRESH https://engineering.linecorp.com/zh-hant/blog/tech-fresh-2020/ 19

Slide 20

Slide 20 text

20

Slide 21

Slide 21 text

Q&A 21