我仅使用从 YouTube 视频中提取音频youtube-dl。我想在下载后将元数据(即艺术家姓名和歌曲标题、年份、专辑、持续时间、流派)写入mp3/m4a 文件中。我尝试从以下代码开始实现此目的:
@echo off
youtube-dl --format m4a/mp3 --youtube-skip-dash-manifest --embed-thumbnail -o "%%(title)s.%%(ext)s" --metadata-from-title "%%(artist)s - %%(title)s" --add-metadata 2Y6Nne8RvaA
pause
Run Code Online (Sandbox Code Playgroud)
此代码产生以下输出:
[youtube] 2Y6Nne8RvaA: Downloading webpage
[youtube] 2Y6Nne8RvaA: Extracting video information
[youtube] 2Y6Nne8RvaA: Downloading thumbnail ...
[youtube] 2Y6Nne8RvaA: Writing thumbnail to: Kungs vs Cookin' on 3 Burners - Thi
s Girl.jpg
[download] Destination: Kungs vs Cookin' on 3 Burners - This Girl.m4a
[download] 100% of 2.99MiB in 00:01
[ffmpeg] Correcting container in "Kungs vs Cookin' on 3 …Run Code Online (Sandbox Code Playgroud) 我整理了一个刮擦Expedia价格/航空公司的原油刮板:
# Start the Server
rD <- rsDriver(browser = "phantomjs", verbose = FALSE)
# Assign the client
remDr <- rD$client
# Establish a wait for an element
remDr$setImplicitWaitTimeout(1000)
# Navigate to Expedia.com
appurl <- "https://www.expedia.com/Flights-Search?flight-type=on&starDate=04/30/2017&mode=search&trip=oneway&leg1=from:Denver,+Colorado,to:Oslo,+Norway,departure:04/30/2017TANYT&passengers=children:0,adults:1"
remDr$navigate(appURL)
# Give a crawl delay to see if it gives time to load web page
Sys.sleep(10) # Been testing with 10
###ADD JAVASCRIPT INJECTION HERE###
remDr$executeScript(?)
# Extract Prices
webElem <- remDr$findElements(using = "css", "[class='dollars price-emphasis']")
prices <- unlist(lapply(webElem, function(x){x$getElementText()}))
print(prices)
# Extract Airlines …Run Code Online (Sandbox Code Playgroud) 我使用只能从youtube视频中提取音频youtube-dl。 下载后,我想将元数据(即艺术家名称和歌曲标题)写入mp3文件。我尝试通过以下代码来实现此目的:
@echo off
set dl=https://www.youtube.com/watch?v=2Y6Nne8RvaA
youtube-dl --metadata-from-title "%(artist)s - %(title)s" --extract-audio --audio-format mp3 -o "%%(title)s.%%(ext)s" --add-metadata %dl%
pause
Run Code Online (Sandbox Code Playgroud)
此代码的输出是:
[youtube] 2Y6Nne8RvaA: Downloading webpage
[youtube] 2Y6Nne8RvaA: Downloading video info webpage
[youtube] 2Y6Nne8RvaA: Extracting video information
[download] Destination: Kungs vs Cookin' on 3 Burners - This Girl.webm
[download] 100% of 3.33MiB in 00:02
[fromtitle] Could not interpret title of video as "(title)s"
[ffmpeg] Adding metadata to 'Kungs vs Cookin' on 3 Burners - This Girl.webm'
[ffmpeg] Destination: Kungs …Run Code Online (Sandbox Code Playgroud) 我有一个包含 438 个投手名称的列表,如下所示(在 XML 节点集中):
\n\n> pitcherlinks[[1]]\n<td class="left " data-append-csv="abadfe01" data-stat="player" csk="Abad,Fernando0.01">\n <a href="/players/a/abadfe01.shtml">Fernando\xc3\x82 Abad</a>*\n</td> \n\n> pitcherlinks[[2]]\n<td class="left " data-append-csv="adlemti01" data-stat="player" csk="Adleman,Tim0.01">\n <a href="/players/a/adlemti01.shtml">Tim\xc3\x82 Adleman</a>\n</td> \nRun Code Online (Sandbox Code Playgroud)\n\n如何提取名称Fernando\xc3\x82 Abad以及相关链接/players/a/abadfe01.shtml