从短链接获取youtube重定向链接

时间:2015-05-07 14:22:38

标签: java android youtube

当我点击网址:

https://www.youtube.com/watch?v=rCiqxFuRi6o&feature=youtu.be&rel=0&wmode=transparent

重定向到

Sub test()
    Dim csv_ap As String
    Dim path_report As String
    Dim ws As Worksheet
    Const MAIN_PATH As String = "FOR_TESTING_ONLY"

    Set ws = Sheets("Mail Report")

    csv_ap = ws.Range("C65000").End(xlUp).Value 'remove offset, you're always going to get a blank cell with it.

    If csv_ap = "NO" Then
        path_report = MAIN_PATH & "For Resolution\" & Format(Date, "dd_mm_yy") & "manual_handling_" & Range("A65000").End(xlUp).Value
        'changed today to date, Excel 2007 doesn't have a today function for me to test with
        Range("B65000").End(xlUp).Value = path_report ' removed offset to match csv_ap
    End If

End Sub

如何从Android应用程序以编程方式获取此重定向链接?

我希望最终获得youtube视频ID。

1 个答案:

答案 0 :(得分:1)

连接时 https://youtu.be/rCiqxFuRi6o?rel=0&wmode=transparent

您将获得http 302状态(重定向):

Sub Work()
    Dim rng As Range
    Dim rngFound As Range

    Set rng = Range("B:B")

    Set rngFound = rng.Find("</>")

    If rngFound Is "</>" Then
        If Cell = "</>" Then

        End If

End Sub

所以你只需要从http响应头读取Location头。