FengHuangWuShen Posted May 27, 2017 Posted May 27, 2017 (edited) So there is a problem when I'm trying to download a video from a certain Facebook URL that has a period in the user's name. ( This is what I'm assuming is the issue ) Example (Successful): https://www.facebook.com/georgehtakei/videos/724646841040246/ Target Download String (Successful): hd_src_no_ratelimit:"https://video.fsnc1-1.fna.fbcdn.net/v/t43.1792-2/18466534_1322798961137400_5231731781023039488_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InN2ZV9oZCJ9&oh=f3443de7c1deb0268abebfe3dac16344&oe=5929400B" Example (Failed): https://www.facebook.com/farcry.usa/videos/10152442352440708/ Target Download String ( Successful ) hd_src_no_ratelimit:"https://video.fsnc1-1.fna.fbcdn.net/v/t43.1792-2/10406044_10152442396970708_278877006_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6ImxlZ2FjeV9oZCJ9&oh=3c29ce9af719a81821488db56888a8e8&oe=59290A67" I noticed that if you remove the . in farcry.usa and just make it farcryusa, it will still resolve to the correct address, but it still fails either way. It's really strange, since I can download videos on any other Facebook page, so far. I get errors on _StringBetween because it is not finding the string. _ArrayToString also fails obviously, because there is no string: --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop (17) Error[1]: No string found. (19) Error[1]: Empty array. +>20:39:31 AutoIt3.exe ended.rc:0 +>20:39:31 AutoIt3Wrapper Finished. >Exit code: 0 Time: 2.77 Here is the full code: expandcollapse popup#include <INet.au3> #include <InetConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <String.au3> #include <WinAPI.au3> #include <WinAPIDlg.au3> OnAutoItExitRegister('INET_CLOSE') $GET_URL = _INetGetSource(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Request', 'Url', Default)) ;ConsoleWrite($GET_URL & @CRLF) $STRING_START = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'Start', Default) $STRING_END = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'End', Default) $GET_STRING = _StringBetween ($GET_URL, $STRING_START, $STRING_END) If @error Then ConsoleWrite('(' & @ScriptLineNumber & ')' & ' Error[' & @error & ']: No string found.' & @CRLF) $VIDEO_URL = _ArrayToString($GET_STRING) If @error Then ConsoleWrite('(' & @ScriptLineNumber & ')' & ' Error[' & @error & ']: Empty array.' & @CRLF) $VIDEO = _URIDecode($VIDEO_URL) If StringLen($VIDEO) > 0 Then Local $VIDEO_DIR = _WinAPI_SaveFileDlg('Save To', @WorkingDir, '*.mp4|*.flv|*.mp3|*.txt|*.exe|*.zip', 1, '', '.', BitOR($OFN_PATHMUSTEXIST, $OFN_OVERWRITEPROMPT)) Local $DOWNLOAD_VIDEO = InetGet($VIDEO, $VIDEO_DIR, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Else MsgBox(0, 'DEBUG', "Video doesn't exist") EndIf Func INET_CLOSE() InetClose($DOWNLOAD_VIDEO) EndFunc Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc Ini File: [Request] Url = https://www.facebook.com/georgehtakei/videos/724646841040246/ [Data] Start = hd_src_no_ratelimit:" End = " [Settings] Delay = 250 ################################################################################################### Instagram : https://www.instagram.com/p/Video ID Or : https://www.instagram.com/p/Video ID/?taken-by=User ID Start = video:secure_url" content=" End = " Facebook : https://www.facebook.com/User ID/videos/Video ID/ Or : Right click on the video and copy URL Start = hd_src_no_ratelimit:" End = " Start = sd_src_no_ratelimit:" End = " ################################################################################################### Edited May 27, 2017 by FengHuangWuShen
FengHuangWuShen Posted May 28, 2017 Author Posted May 28, 2017 Problem solved. The page is not public, so it is returning the login page, instead of the page I need. Future problem to fix I guess haha
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now