├── .gitattributes ├── .gitignore ├── App.config ├── LICENSE ├── PPD.snk ├── PornhubPhotoDownloader.csproj ├── PornhubPhotoDownloader.sln ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.en.resx └── Resources.resx ├── README.md ├── docs └── Images │ └── 00.png └── packages.config /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Nicengi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PPD.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicengi/PornhubPhotoDownloader/99ef325a8df2df65deb6f0f6ef1d492abab473f9/PPD.snk -------------------------------------------------------------------------------- /PornhubPhotoDownloader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Debug 7 | AnyCPU 8 | {B9484BDC-149C-4580-8667-108EFF103CFF} 9 | Exe 10 | PornhubPhotoDownloader 11 | PPD 12 | v4.6 13 | 512 14 | true 15 | true 16 | 17 | 18 | 19 | 20 | AnyCPU 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | AnyCPU 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | true 40 | bin\Debug\ 41 | TRACE;DEBUG;TEST_ARGS 42 | full 43 | AnyCPU 44 | 7.3 45 | prompt 46 | MinimumRecommendedRules.ruleset 47 | true 48 | 49 | 50 | true 51 | 52 | 53 | PPD.snk 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | True 73 | True 74 | Resources.resx 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | ResXFileCodeGenerator 86 | Resources.Designer.cs 87 | 88 | 89 | 90 | 91 | 92 | 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /PornhubPhotoDownloader.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29709.97 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PornhubPhotoDownloader", "PornhubPhotoDownloader.csproj", "{B9484BDC-149C-4580-8667-108EFF103CFF}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug-TestArgs|Any CPU = Debug-TestArgs|Any CPU 12 | Release|Any CPU = Release|Any CPU 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {B9484BDC-149C-4580-8667-108EFF103CFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 16 | {B9484BDC-149C-4580-8667-108EFF103CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU 17 | {B9484BDC-149C-4580-8667-108EFF103CFF}.Debug-TestArgs|Any CPU.ActiveCfg = Debug-TestArgs|Any CPU 18 | {B9484BDC-149C-4580-8667-108EFF103CFF}.Debug-TestArgs|Any CPU.Build.0 = Debug-TestArgs|Any CPU 19 | {B9484BDC-149C-4580-8667-108EFF103CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {B9484BDC-149C-4580-8667-108EFF103CFF}.Release|Any CPU.Build.0 = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | GlobalSection(ExtensibilityGlobals) = postSolution 26 | SolutionGuid = {248EFE92-A5B0-451D-8C26-35A20BFE6D2F} 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Net; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Text.RegularExpressions; 8 | using System.Threading; 9 | 10 | namespace PornhubPhotoDownloader 11 | { 12 | class Program 13 | { 14 | const int SETTING_RETRYCOUNT = 5; 15 | 16 | const string ARG_HELP = "?"; 17 | const string ARG_DOWNLOADDIR = "dir"; 18 | const string ARG_ALL = "all"; 19 | const string ARG_STARTINDEX = "index"; 20 | const string ARG_LENGTH = "length"; 21 | const string ARG_DEBUG = "debug"; 22 | const string ARG_DEBUG_INFO = "info"; 23 | const string ARG_LANG = "lang"; 24 | const string ARG_RENAME = "rename"; 25 | 26 | const string REPLACE_DOWNLOADDIR_ALBUM = "{album}"; 27 | const string REPLACE_DOWNLOADDIR_ID = "{id}"; 28 | const string REPLACE_DOWNLOADDIR_PAGE = "{page}"; 29 | 30 | const string REPLACE_PHOTO_INDEX = "{index}"; 31 | const string REPLACE_PHOTO_ID = "{id}"; 32 | const string REPLACE_PHOTO_ALBUM_ID = "{albumid}"; 33 | const string REPLACE_PHOTO_ALBUM = "{album}"; 34 | const string REPLACE_PHOTO_EXT = "{ext}"; 35 | 36 | static WebClient WebClient = new WebClient(); 37 | static Dictionary Args = new Dictionary(); 38 | static bool IsDebug; 39 | static bool IsDebugInfo; 40 | static string DefaultDownloadDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Downloads\\{id}"); 41 | 42 | static void Main(string[] args) 43 | { 44 | #if TEST_ARGS 45 | args = new string[] 46 | { 47 | "https://cn.pornhub.com/album/48071401", 48 | "-all", 49 | "-debug", 50 | }; 51 | #endif 52 | #region Parse Args 53 | foreach (string arg in args) 54 | { 55 | if (arg[0] == '-' || arg[0] == '/') 56 | { 57 | int index = arg.IndexOf(":"); 58 | string key = arg.Substring(1, index == -1 ? arg.Length - 1 : index - 1).ToLower(); 59 | string value = arg.Substring(index + 1, arg.Length - index - 1); 60 | 61 | if (Args.ContainsKey(key)) 62 | { 63 | Args.Remove(key); 64 | } 65 | 66 | Args.Add(key, value); 67 | } 68 | } 69 | 70 | if (Args.ContainsKey(ARG_LANG)) 71 | { 72 | try 73 | { 74 | Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Args[ARG_LANG]); 75 | } 76 | catch (Exception e) 77 | { 78 | ThrowException(e); 79 | Console.WriteLine(); 80 | return; 81 | } 82 | } 83 | 84 | if (args.Length < 1 || Args.ContainsKey(ARG_HELP)) 85 | { 86 | Console.WriteLine(string.Format("{0}", Properties.Resources.Msg_Help_Use)); 87 | Console.WriteLine(); 88 | Console.WriteLine(string.Format(" -All {0}", Properties.Resources.Msg_Help_All)); 89 | Console.WriteLine(string.Format(" -Dir: {0}", Properties.Resources.Msg_Help_DownloadDir)); 90 | Console.WriteLine(string.Format(" -Index: {0}", Properties.Resources.Msg_Help_StartIndex)); 91 | Console.WriteLine(string.Format(" -Length: {0}", Properties.Resources.Msg_Help_Length)); 92 | Console.WriteLine(string.Format(" -Debug {0}", Properties.Resources.Msg_Help_Debug)); 93 | Console.WriteLine(string.Format(" -Info {0}", Properties.Resources.Msg_Help_DebugInfo)); 94 | Console.WriteLine(string.Format(" -Rename: {0}", Properties.Resources.Msg_Help_Rename)); 95 | Console.WriteLine(); 96 | Console.WriteLine(Properties.Resources.Msg_Help_Rename_Keywords); 97 | Console.WriteLine(); 98 | Console.WriteLine(Properties.Resources.Msg_Help_DownloadDir_Keywords); 99 | Console.WriteLine(); 100 | return; 101 | } 102 | 103 | if (!Args.ContainsKey(ARG_DOWNLOADDIR)) 104 | { 105 | Args.Add(ARG_DOWNLOADDIR, DefaultDownloadDir); 106 | } 107 | if (string.IsNullOrWhiteSpace(Args[ARG_DOWNLOADDIR])) 108 | { 109 | Args[ARG_DOWNLOADDIR] = DefaultDownloadDir; 110 | } 111 | 112 | IsDebug = Args.ContainsKey(ARG_DEBUG); 113 | IsDebugInfo = Args.ContainsKey(ARG_DEBUG_INFO); 114 | 115 | if (!LinkInfo.TryParse(args[0], out LinkInfo argLink)) 116 | { 117 | if (IsDebug) 118 | { 119 | Console.WriteLine(string.Format(Properties.Resources.Msg_InvalidLink, args[0])); 120 | } 121 | Console.WriteLine(); 122 | return; 123 | } 124 | #endregion 125 | 126 | #region Console Title 127 | Console.Title = $"{Properties.Resources.Title}: {getArgsString(args)}"; 128 | string getArgsString(string[] _args) 129 | { 130 | string result = string.Empty; 131 | foreach (string _arg in _args) 132 | { 133 | result += $"{_arg} "; 134 | } 135 | return result.Trim(); 136 | } 137 | #endregion 138 | 139 | try 140 | { 141 | if (argLink.Type.ToLower() == "album") 142 | { 143 | Regex loadingRegex = new Regex("\\s*Loading \\.\\.\\.\\s*"); 144 | if (Args.ContainsKey(ARG_ALL)) 145 | { 146 | Regex corruptRegex = new Regex("
\\s*

[\\S\\s]*

"); 147 | int pageIndex = 1; 148 | argLink.Args = $"?page={pageIndex}"; 149 | Console.WriteLine(string.Format(Properties.Resources.Msg_Album_Download, argLink.FullUrl)); 150 | string albumHtmlText = GetHtmlText(argLink.FullUrl); 151 | 152 | while (!corruptRegex.IsMatch(albumHtmlText) || loadingRegex.IsMatch(albumHtmlText)) 153 | { 154 | if (loadingRegex.IsMatch(albumHtmlText)) 155 | { 156 | if (IsDebug) 157 | { 158 | Console.ForegroundColor = ConsoleColor.Yellow; 159 | Console.WriteLine($"Regex '{loadingRegex}' is matched. Retrying in 5 seconds."); 160 | Console.ResetColor(); 161 | } 162 | 163 | Thread.Sleep(5000); 164 | albumHtmlText = GetHtmlText(argLink.FullUrl); 165 | continue; 166 | } 167 | 168 | DownloadAlbum(albumHtmlText, argLink, GetDownloadDir(argLink, albumHtmlText, pageIndex.ToString())); 169 | pageIndex++; 170 | argLink.Args = $"?page={pageIndex}"; 171 | Console.WriteLine(string.Format(Properties.Resources.Msg_Album_Download, argLink.FullUrl)); 172 | albumHtmlText = GetHtmlText(argLink.FullUrl); 173 | } 174 | ConsoleBackLine(); //Empty page. 175 | } 176 | else 177 | { 178 | Console.WriteLine(string.Format(Properties.Resources.Msg_Album_Download, argLink.FullUrl)); 179 | string albumHtmlText = GetHtmlText(argLink.FullUrl); 180 | 181 | while (loadingRegex.IsMatch(albumHtmlText)) 182 | { 183 | if (IsDebug) 184 | { 185 | Console.ForegroundColor = ConsoleColor.Yellow; 186 | Console.WriteLine($"Regex '{loadingRegex}' is matched. Retrying in 5 seconds."); 187 | Console.ResetColor(); 188 | } 189 | 190 | Thread.Sleep(5000); 191 | albumHtmlText = GetHtmlText(argLink.FullUrl); 192 | } 193 | 194 | DownloadAlbum(albumHtmlText, argLink, 195 | GetDownloadDir(argLink, albumHtmlText, "1"), 196 | Args.ContainsKey(ARG_STARTINDEX) ? Convert.ToInt32(Args[ARG_STARTINDEX]) : 0, 197 | Args.ContainsKey(ARG_LENGTH) ? Convert.ToInt32(Args[ARG_LENGTH]) : 0); 198 | } 199 | } 200 | else if (argLink.Type.ToLower() == "photo") 201 | { 202 | DownloadPhoto(argLink, GetDownloadDir(argLink, string.Empty)); 203 | } 204 | } 205 | catch (Exception e) 206 | { 207 | ThrowException(e); 208 | } 209 | 210 | Console.ForegroundColor = ConsoleColor.Yellow; 211 | Console.WriteLine(Properties.Resources.Msg_AllDone); 212 | Console.ResetColor(); 213 | Console.WriteLine(); 214 | } 215 | 216 | static string GetDownloadDir(LinkInfo link, string htmlText, string pageIndex = "0") 217 | { 218 | string albumName = $"{link.Type}-{link.ID}"; 219 | Regex albumNameRegex = new Regex("

\\s*(?[\\S\\s].*?)\\s*\\s*

"); 220 | if (albumNameRegex.IsMatch(htmlText)) 221 | { 222 | albumName = albumNameRegex.Match(htmlText).Groups["album"].Value; 223 | } 224 | 225 | string result = Args[ARG_DOWNLOADDIR] 226 | .Replace(REPLACE_DOWNLOADDIR_ALBUM, albumName) 227 | .Replace(REPLACE_DOWNLOADDIR_ID, link.ID) 228 | .Replace(REPLACE_DOWNLOADDIR_PAGE, pageIndex); 229 | foreach (char ch in Path.GetInvalidPathChars()) 230 | { 231 | result = result.Replace(ch.ToString(), string.Empty); 232 | } 233 | 234 | return result; 235 | } 236 | 237 | static void DownloadAlbum(string albumHtmlText, LinkInfo albumLink, string downloadDir, int startIndex = 0, int length = 0) 238 | { 239 | List photoLinks = new List(); 240 | Regex regex = new Regex("/photo/[0-9]+)\">"); 241 | foreach (Match match in regex.Matches(albumHtmlText)) 242 | { 243 | LinkInfo photoLink = LinkInfo.Parse($"{albumLink.Host}{match.Groups["photoLink"].Value}"); 244 | 245 | if (photoLink != null) 246 | { 247 | photoLinks.Add(photoLink); 248 | } 249 | } 250 | 251 | DownloadPhotos(photoLinks.ToArray(), downloadDir, startIndex, length); 252 | } 253 | 254 | static void DownloadPhoto(LinkInfo photoLink, string downloadDir) 255 | { 256 | DownloadPhotos(new LinkInfo[] { photoLink }, downloadDir); 257 | } 258 | 259 | static void DownloadPhotos(LinkInfo[] photoLinks, string downloadDir, int startIndex = 0, int length = 0) 260 | { 261 | int retryCount = 0; 262 | int _startIndex = (startIndex < 0 || startIndex >= photoLinks.Length) ? 0 : startIndex; 263 | int _length = (length + _startIndex < 1 || length + _startIndex > photoLinks.Length) ? photoLinks.Length : length + _startIndex; 264 | 265 | if (IsDebug) 266 | { 267 | Console.ForegroundColor = ConsoleColor.Yellow; 268 | Console.WriteLine($"StartIndex: {_startIndex}({startIndex}) Length: {_length}({length}) Count: {photoLinks.Length}"); 269 | Console.WriteLine($"Dir: {Path.GetFullPath(downloadDir)}"); 270 | Console.ResetColor(); 271 | } 272 | 273 | if (!Directory.Exists(downloadDir)) 274 | { 275 | Directory.CreateDirectory(downloadDir); 276 | if (IsDebug) 277 | { 278 | Console.ForegroundColor = ConsoleColor.Red; 279 | Console.WriteLine($"Dir created!"); 280 | Console.ResetColor(); 281 | } 282 | } 283 | 284 | for (int i = _startIndex; i < _length; i++) 285 | { 286 | LinkInfo photoLink = photoLinks[i]; 287 | Console.ForegroundColor = ConsoleColor.Blue; 288 | Console.WriteLine(string.Format( 289 | $"{(retryCount == 0 ? $"{Properties.Resources.Msg_Photo_Download}" : $"{Properties.Resources.Msg_Photo_Download_Retrying}")}", 290 | photoLink.FullUrl, i + 1, photoLinks.Length, retryCount)); 291 | Console.ResetColor(); 292 | try 293 | { 294 | string photoHtmlText = GetHtmlText(photoLink.FullUrl); 295 | string photoSourceUrl = GetPhotoSourceUrl(photoHtmlText); 296 | //TODO: Loading page match. 297 | ConsoleBackLine(); 298 | Console.ForegroundColor = ConsoleColor.Blue; 299 | Console.WriteLine(string.Format(Properties.Resources.Msg_Photo_Downloading, Path.GetFileName(photoSourceUrl), i + 1, photoLinks.Length)); 300 | Console.ResetColor(); 301 | 302 | string fileName = Path.GetFileName(photoSourceUrl); 303 | if (Args.ContainsKey(ARG_RENAME) && !string.IsNullOrWhiteSpace(Args[ARG_RENAME])) 304 | { 305 | Regex fromAlbumRegex = new Regex("[0-9]+)\">(?.*?)"); 306 | Match fromAlbumMatch = fromAlbumRegex.Match(photoHtmlText); 307 | string r_index = i.ToString(); 308 | string r_id = photoLink.ID; 309 | string r_albumid = fromAlbumMatch.Groups["album_id"].Value; 310 | string r_album = fromAlbumMatch.Groups["album"].Value; 311 | string r_ext = Path.GetExtension(photoSourceUrl); 312 | 313 | fileName = Args[ARG_RENAME] 314 | .Replace(REPLACE_PHOTO_INDEX, r_index) 315 | .Replace(REPLACE_PHOTO_ID, r_id) 316 | .Replace(REPLACE_PHOTO_ALBUM_ID, r_albumid) 317 | .Replace(REPLACE_PHOTO_ALBUM, r_album) 318 | .Replace(REPLACE_PHOTO_EXT, r_ext); 319 | 320 | foreach (char ch in Path.GetInvalidFileNameChars()) 321 | { 322 | fileName = fileName.Replace(ch.ToString(), string.Empty); 323 | } 324 | } 325 | 326 | WebClient.DownloadFile(photoSourceUrl, Path.Combine(downloadDir, fileName)); 327 | ConsoleBackLine(); 328 | Console.ForegroundColor = ConsoleColor.Green; 329 | Console.WriteLine(string.Format(Properties.Resources.Msg_Photo_DownloadCompleted, photoLink.FullUrl /*Path.GetFileName(photoSourceUrl)*/, i + 1, photoLinks.Length, fileName)); 330 | Console.ResetColor(); 331 | retryCount = 0; 332 | } 333 | catch (Exception e) 334 | { 335 | if (IsDebug) 336 | { 337 | ConsoleBackLine(); 338 | } 339 | ThrowException(e); 340 | if (retryCount < SETTING_RETRYCOUNT) 341 | { 342 | retryCount++; 343 | if (IsDebug) 344 | { 345 | Console.ForegroundColor = ConsoleColor.Yellow; 346 | Console.WriteLine($"Download failed. Retrying in 5 seconds. ({retryCount})"); 347 | Console.ResetColor(); 348 | } 349 | Thread.Sleep(5000); 350 | /*if (IsDebug)*/ 351 | ConsoleBackLine(); 352 | i--; 353 | continue; 354 | } 355 | else 356 | { 357 | Console.ForegroundColor = ConsoleColor.Red; 358 | Console.WriteLine(string.Format(Properties.Resources.Msg_Photo_DownloadFailed, photoLink.FullUrl, i + 1, photoLinks.Length)); 359 | Console.ResetColor(); 360 | retryCount = 0; 361 | } 362 | } 363 | } 364 | } 365 | 366 | static string GetHtmlText(string url) 367 | { 368 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); 369 | request.Timeout = 30 * 1000; 370 | request.AllowAutoRedirect = true; 371 | request.UserAgent = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"; 372 | request.Method = "GET"; 373 | request.KeepAlive = true; 374 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 375 | using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) 376 | { 377 | return reader.ReadToEnd(); 378 | } 379 | } 380 | 381 | static string GetPhotoSourceUrl(string htmlText) 382 | { 383 | Regex regex = new Regex("\\s*\\S+/\\S+original_[0-9]+\\.jpg)\"[\\S\\s]*?>\\s*"); 384 | if (regex.IsMatch(htmlText)) 385 | { 386 | Match match = regex.Match(htmlText); 387 | return match.Groups["src"].Value; 388 | } 389 | return null; 390 | } 391 | 392 | static void ConsoleBackLine() 393 | { 394 | Console.SetCursorPosition(0, Console.CursorTop - 1); 395 | Console.Write(string.Empty.PadRight(Console.WindowWidth)); 396 | Console.SetCursorPosition(0, Console.CursorTop - 1); 397 | } 398 | 399 | static void ThrowException(Exception e) 400 | { 401 | if (IsDebug) 402 | { 403 | Console.BackgroundColor = ConsoleColor.Black; 404 | Console.ForegroundColor = ConsoleColor.Red; 405 | Console.WriteLine(e.Message); 406 | if (IsDebugInfo) 407 | { 408 | if (e.InnerException != null) 409 | { 410 | Console.WriteLine($"InnerException: {e.InnerException.Message}"); 411 | } 412 | Console.WriteLine($"StackTrace:\r\n{e.StackTrace}"); 413 | Console.WriteLine(); 414 | } 415 | Console.ResetColor(); 416 | } 417 | } 418 | 419 | /// 420 | /// Pornhub album or photo format link. 421 | /// 422 | class LinkInfo 423 | { 424 | #region Properties 425 | public string Protocol { get; set; } 426 | //public string Region { get; set; } 427 | public string Type { get; set; } 428 | public string ID { get; set; } 429 | public string Host { get; set; } 430 | public string Args { get; set; } 431 | public string UrlWithoutArgs 432 | { 433 | get 434 | { 435 | return $"{Host}/{Type}/{ID}"; 436 | } 437 | } 438 | public string FullUrl 439 | { 440 | get 441 | { 442 | return $"{Host}/{Type}/{ID}{Args}"; 443 | } 444 | } 445 | 446 | private static Regex regex = new Regex("(?(?(?:(?[http|https]+)://)?(?:(?\\w{2,})\\.)?pornhub\\.com)/(?\\w+)/(?[0-9]+))(?\\?\\S+)?"); 447 | #endregion 448 | 449 | #region Methods 450 | public static LinkInfo Parse(string url) 451 | { 452 | if (regex.IsMatch(url)) 453 | { 454 | Match match = regex.Match(url); 455 | return new LinkInfo() 456 | { 457 | Protocol = match.Groups["protocol"].Value, 458 | //Region = match.Groups["region"].Value, 459 | Type = match.Groups["type"].Value, 460 | ID = match.Groups["id"].Value, 461 | Host = match.Groups["host"].Value, 462 | Args = match.Groups["args"].Value, 463 | //UrlWithoutArgs = match.Groups["url_without_args"].Value, 464 | //FullUrl = url, 465 | }; 466 | } 467 | return null; 468 | } 469 | 470 | public static bool TryParse(string url, out LinkInfo result) 471 | { 472 | return (result = Parse(url)) != null; 473 | } 474 | #endregion 475 | } 476 | } 477 | } 478 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Pornhub Photo Downloader")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Pornhub Photo Downloader")] 13 | [assembly: AssemblyCopyright("")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("b9484bdc-149c-4580-8667-108eff103cff")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 33 | //通过使用 "*",如下所示: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.1.0.20519")] 37 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace PornhubPhotoDownloader.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PornhubPhotoDownloader.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// 查找类似 开始下载“{0}”。 的本地化字符串。 65 | /// 66 | internal static string Msg_Album_Download { 67 | get { 68 | return ResourceManager.GetString("Msg.Album.Download", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// 查找类似 全部完成。 的本地化字符串。 74 | /// 75 | internal static string Msg_AllDone { 76 | get { 77 | return ResourceManager.GetString("Msg.AllDone", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// 查找类似 下载相册的所有照片。 的本地化字符串。 83 | /// 84 | internal static string Msg_Help_All { 85 | get { 86 | return ResourceManager.GetString("Msg.Help.All", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// 查找类似 显示调试信息。 的本地化字符串。 92 | /// 93 | internal static string Msg_Help_Debug { 94 | get { 95 | return ResourceManager.GetString("Msg.Help.Debug", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// 查找类似 显示更多的调试信息。这是“-Debug”的附加选项。 的本地化字符串。 101 | /// 102 | internal static string Msg_Help_DebugInfo { 103 | get { 104 | return ResourceManager.GetString("Msg.Help.DebugInfo", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// 查找类似 指定下载目录。 的本地化字符串。 110 | /// 111 | internal static string Msg_Help_DownloadDir { 112 | get { 113 | return ResourceManager.GetString("Msg.Help.DownloadDir", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// 查找类似 指定“-Dir”选项时可用使用“{id}”、“{album}”、“{page}”关键字。 119 | ///下载照片时“{album}”关键字将被格式化为“photo-{id}”。 的本地化字符串。 120 | /// 121 | internal static string Msg_Help_DownloadDir_Keywords { 122 | get { 123 | return ResourceManager.GetString("Msg.Help.DownloadDir.Keywords", resourceCulture); 124 | } 125 | } 126 | 127 | /// 128 | /// 查找类似 指定将下载的照片数量。指定“-All”时选项将被忽略。 的本地化字符串。 129 | /// 130 | internal static string Msg_Help_Length { 131 | get { 132 | return ResourceManager.GetString("Msg.Help.Length", resourceCulture); 133 | } 134 | } 135 | 136 | /// 137 | /// 查找类似 使用指定的格式重命名文件。 的本地化字符串。 138 | /// 139 | internal static string Msg_Help_Rename { 140 | get { 141 | return ResourceManager.GetString("Msg.Help.Rename", resourceCulture); 142 | } 143 | } 144 | 145 | /// 146 | /// 查找类似 指定“-Rename”选项时可用使用“{index}”、“{id}”、“{albumid}”、“{album}”、“{ext}”关键字。 的本地化字符串。 147 | /// 148 | internal static string Msg_Help_Rename_Keywords { 149 | get { 150 | return ResourceManager.GetString("Msg.Help.Rename.Keywords", resourceCulture); 151 | } 152 | } 153 | 154 | /// 155 | /// 查找类似 指定起始的下载位置(从零开始)。指定“-All”时选项将被忽略。 的本地化字符串。 156 | /// 157 | internal static string Msg_Help_StartIndex { 158 | get { 159 | return ResourceManager.GetString("Msg.Help.StartIndex", resourceCulture); 160 | } 161 | } 162 | 163 | /// 164 | /// 查找类似 PPD <url> [-All] [-Dir:<path>] [-Index:0] [Length:5] 的本地化字符串。 165 | /// 166 | internal static string Msg_Help_Use { 167 | get { 168 | return ResourceManager.GetString("Msg.Help.Use", resourceCulture); 169 | } 170 | } 171 | 172 | /// 173 | /// 查找类似 无效的链接“{0}”。 的本地化字符串。 174 | /// 175 | internal static string Msg_InvalidLink { 176 | get { 177 | return ResourceManager.GetString("Msg.InvalidLink", resourceCulture); 178 | } 179 | } 180 | 181 | /// 182 | /// 查找类似 开始下载“{0}”,第 {1} 个,共 {2} 个。 的本地化字符串。 183 | /// 184 | internal static string Msg_Photo_Download { 185 | get { 186 | return ResourceManager.GetString("Msg.Photo.Download", resourceCulture); 187 | } 188 | } 189 | 190 | /// 191 | /// 查找类似 正在重试“{0}”,第 {1} 个,共 {2} 个。第 {3} 次。 的本地化字符串。 192 | /// 193 | internal static string Msg_Photo_Download_Retrying { 194 | get { 195 | return ResourceManager.GetString("Msg.Photo.Download.Retrying", resourceCulture); 196 | } 197 | } 198 | 199 | /// 200 | /// 查找类似 下载完成“{0}”,第 {1} 个,共 {2} 个。 的本地化字符串。 201 | /// 202 | internal static string Msg_Photo_DownloadCompleted { 203 | get { 204 | return ResourceManager.GetString("Msg.Photo.DownloadCompleted", resourceCulture); 205 | } 206 | } 207 | 208 | /// 209 | /// 查找类似 下载失败“{0}”,第 {1} 个,共 {2} 个。 的本地化字符串。 210 | /// 211 | internal static string Msg_Photo_DownloadFailed { 212 | get { 213 | return ResourceManager.GetString("Msg.Photo.DownloadFailed", resourceCulture); 214 | } 215 | } 216 | 217 | /// 218 | /// 查找类似 正在下载“{0}”,第 {1} 个,共 {2} 个。 的本地化字符串。 219 | /// 220 | internal static string Msg_Photo_Downloading { 221 | get { 222 | return ResourceManager.GetString("Msg.Photo.Downloading", resourceCulture); 223 | } 224 | } 225 | 226 | /// 227 | /// 查找类似 Pornhub 照片下载 的本地化字符串。 228 | /// 229 | internal static string Title { 230 | get { 231 | return ResourceManager.GetString("Title", resourceCulture); 232 | } 233 | } 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /Properties/Resources.en.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Download "{0}" 122 | 123 | 124 | All done! 125 | 126 | 127 | Download all photo of the album. 128 | 129 | 130 | Show debugging information. 131 | 132 | 133 | Show more debugging information. Option for "-Debug". 134 | 135 | 136 | Download directory. 137 | 138 | 139 | Download length. 140 | 141 | 142 | Download starting position (zero-based). 143 | 144 | 145 | Invalid link "{0}". 146 | 147 | 148 | Download "{0}". ({1} of {2}) 149 | 150 | 151 | Retrying "{0}". ({1} of {2}) ({3}) 152 | 153 | 154 | Completed "{0}". ({1} of {2}) 155 | 156 | 157 | Failed "{0}". ({1} of {2}) 158 | 159 | 160 | Downloading "{0}". ({1} of {2}) 161 | 162 | 163 | Pornhub Photo Downloader 164 | 165 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 开始下载“{0}”。 122 | 123 | 124 | 全部完成。 125 | 126 | 127 | 下载相册的所有照片。 128 | 129 | 130 | 显示调试信息。 131 | 132 | 133 | 显示更多的调试信息。这是“-Debug”的附加选项。 134 | 135 | 136 | 指定下载目录。 137 | 138 | 139 | 指定“-Dir”选项时可用使用“{id}”、“{album}”、“{page}”关键字。 140 | 下载照片时“{album}”关键字将被格式化为“photo-{id}”。 141 | 142 | 143 | 指定将下载的照片数量。指定“-All”时选项将被忽略。 144 | 145 | 146 | 使用指定的格式重命名文件。 147 | 148 | 149 | 指定“-Rename”选项时可用使用“{index}”、“{id}”、“{albumid}”、“{album}”、“{ext}”关键字。 150 | 151 | 152 | 指定起始的下载位置(从零开始)。指定“-All”时选项将被忽略。 153 | 154 | 155 | PPD <url> [-All] [-Dir:<path>] [-Index:0] [Length:5] 156 | 157 | 158 | 无效的链接“{0}”。 159 | 160 | 161 | 开始下载“{0}”,第 {1} 个,共 {2} 个。 162 | 163 | 164 | 正在重试“{0}”,第 {1} 个,共 {2} 个。第 {3} 次。 165 | 166 | 167 | 下载完成“{0}”,第 {1} 个,共 {2} 个。 168 | 169 | 170 | 下载失败“{0}”,第 {1} 个,共 {2} 个。 171 | 172 | 173 | 正在下载“{0}”,第 {1} 个,共 {2} 个。 174 | 175 | 176 | Pornhub 照片下载 177 | 178 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pornhub Photo Downloader 2 | 3 |

4 | Downloads 5 | License 6 |

7 | 8 | 批量下载 Pornhub 上的相册或照片。 9 | 10 | ```powershell 11 | 示例 .\ppd "https://cn.pornhub.com/album/48071401" -all 12 | ``` 13 | 14 | #### 重命名 15 | 16 | ​ 使用[关键字](#参数)以重命名下载目录和文件名。 17 | 18 | ```powershell 19 | 示例 .\ppd "https://cn.pornhub.com/album/48071401" -all -dir:"Downloads\{album}" 20 | ``` 21 | 22 | ## 参数 23 | 24 | | 名称 | 描述 | 附加 | 25 | | ----------------- | -------------------------------- | ---------------------------------------------------------- | 26 | | {url} | 相册或照片链接。 | 必须在参数列表的首位。 | 27 | | -All | 下载相册的所有照片。 | 仅相册。 | 28 | | -Dir:{path} | 指定下载目录。 | 关键字“{id}”、“{album}”、“{page}”。 | 29 | | -Index:{value} | 指定起始的下载位置(从零开始)。 | 指定“-All”时选项将被忽略。 | 30 | | -Length:{value} | 指定将下载的照片数量。 | 指定“-All”时选项将被忽略。 | 31 | | -Debug | 显示调试信息。 | | 32 | | -Info | 显示更多的调试信息。 | 这是“-Debug”的附加选项。 | 33 | | -Lang:{value} | 指定区域。 | -Lang:en | 34 | | -Rename:{pattern} | 使用指定的格式重命名文件。 | 关键字“{index}”、“{id}”、“{albumid}”、“{album}”、“{ext}”。 | 35 | 36 | ## 截图 37 | 38 | ![00](docs/Images/00.png) -------------------------------------------------------------------------------- /docs/Images/00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicengi/PornhubPhotoDownloader/99ef325a8df2df65deb6f0f6ef1d492abab473f9/docs/Images/00.png -------------------------------------------------------------------------------- /packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | --------------------------------------------------------------------------------