mirror of
				https://github.com/Mabbs/mabbs.github.io
				synced 2025-10-31 17:12:09 +08:00 
			
		
		
		
	Restore deleted repositories
This commit is contained in:
		
							
								
								
									
										85
									
								
								_posts/2019-04-13-iwara.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								_posts/2019-04-13-iwara.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | ||||
| --- | ||||
| layout: post | ||||
| title: 如何下载Iwara上的视频? | ||||
| tags: [Iwara, PHP, 视频] | ||||
| --- | ||||
|  | ||||
|   PHP果然是全世界最好的语言,我又用PHP解决了一个问题!<!--more-->  | ||||
|    | ||||
| # 制作原因 | ||||
|   Iwara(Ecchi)上的视频是真的有意思,尤其是镇站之宝OBSERVATION DIARY,简直是R183D动画的巅峰 ~~(请原谅我的孤陋寡闻)~~ ,所以为了更好的看Iwara上的的视频,我写了Iwara Viewer来帮助我们下载Iwara(Ecchi)上面的视频。 | ||||
|  | ||||
| # Code | ||||
| ```php | ||||
| <?php | ||||
| if ( $_GET["ID"] == '' ) { | ||||
| if ( $_GET["page"] == '' ) { | ||||
|     $_GET["page"] = 0; | ||||
| } | ||||
| if ( $_GET["sort"] == '' ) { | ||||
|     $_GET["sort"] = "date"; | ||||
| } | ||||
| $url = 'https://ecchi.iwara.tv/videos?page='.$_GET["page"].'&sort='.$_GET["sort"]; | ||||
| $str = file_get_contents($url); | ||||
| $preg='/<a href="\/videos\/(.*?)".*?>(.*?)<\/a>/is'; | ||||
| preg_match_all($preg,$str,$match);//在$str中搜索匹配所有符合$preg加入$match中 | ||||
| echo "<title>Mayx Iwara Viewer</title>"; | ||||
| echo "<h1>Mayx Iwara Viewer</h1><br />Sort by: <a href=\"?page=".$_GET["page"]."&sort=date\">Date</a> <a href=\"?page=".$_GET["page"]."&sort=views\">Views</a> <a href=\"?page=".$_GET["page"]."&sort=likes\">Likes</a><hr /><table border=\"1\"><tr>"; | ||||
| $j=0; | ||||
| for($i=0;$i<count($match[0]);$i++)//逐个输出超链接地址 | ||||
| { | ||||
| if (($i % 2) == $j) { | ||||
|   if ( $match[1][$i] == $match[1][$i+1] ) { | ||||
|   echo "<td><a href=\"https://ecchi.iwara.tv/videos/".$match[1][$i]."\">".$match[2][$i]."</a></td>"; | ||||
|   } else { | ||||
|   echo "<td><a href=\"https://ecchi.iwara.tv/videos/".$match[1][$i]."\">No Image</a></td><td>".$match[2][$i]."</td><td><a href=\"https://ecchi.iwara.tv/videos/".$match[1][$i]."\">View in Iwara</a><br><a href=\"?ID=https://ecchi.iwara.tv/videos/".$match[1][$i]."\">Download Url in Server</a></td></tr><tr>"; | ||||
|   if ($j == 0) { | ||||
|       $j = 1; | ||||
|   } else { | ||||
|       $j = 0; | ||||
|   } | ||||
|   } | ||||
| } else { | ||||
|   echo "<td>".$match[2][$i]."</td><td><a href=\"https://ecchi.iwara.tv/videos/".$match[1][$i]."\">View in Iwara</a><br><a href=\"?ID=https://ecchi.iwara.tv/videos/".$match[1][$i]."\">Download Url in Server</a></td></tr><tr>"; | ||||
| } | ||||
| } | ||||
| echo "</tr></table><hr><a href=\"?page=".($_GET["page"] + 1)."&sort=".$_GET["sort"]."\" >Next Page</a>"; | ||||
| } else { | ||||
| $data = file_get_contents('https://ecchi.iwara.tv/api/video/'.trim(strrchr($_GET["ID"], '/'),'/')); | ||||
| $file = json_decode($data,true); | ||||
|  | ||||
| echo "Download URL:<br>https:"; | ||||
| echo $file[0]['uri']; | ||||
| } | ||||
| ``` | ||||
| (2019.4.18 更新:解决了部分没有图片而导致错位的问题)    | ||||
| (2019.4.18 更新:解决了由于智障导致的图片被筛掉的问题,但是并不保证会不会再出现问题) | ||||
|  | ||||
| # 使用方法 | ||||
|  除了比Iwara更简陋,其他的没什么太大的区别,增加了一个Download Url in Server的选项,用来帮助在服务器上直接下载视频(因为Iwara通过识别IP来防盗链……),得出的链接可直接在服务器上下载(比如用KodExplorer),在服务器上下载的速度还是很不错的。    | ||||
|  不过有的时候Iwara图片服务器也会被Ban(比如移动网),这时候就应该用到[miniProxy](https://github.com/joshdick/miniProxy)了(当然代码也得改,就是我太懒了,懒得改2333) | ||||
|   | ||||
| # 缺点 | ||||
|  没有观看数/作者等信息、而且不知道Iwara的服务器在哪里,用这个速度浏览的速度也不会有太大提升…… | ||||
|  | ||||
| # 演示 | ||||
|   <https://counter.mayx.me/iwaraview.php>    | ||||
|   如需用演示站下载,可复制地址,然后用Download Tool下载(因为演示站的IP和你的服务器IP不同): | ||||
| ```php | ||||
| <h1>Mayx Iwara Video Download Tool</h1><form action="iwara.php" method="get" > | ||||
|  | ||||
| Video URL: <input type="text" name="ID"><br> | ||||
| <input type="submit"> | ||||
|  | ||||
| </form> | ||||
| <br> | ||||
| <?php | ||||
| if ( $_GET["ID"] != '' ) { | ||||
|  $data = file_get_contents('https://ecchi.iwara.tv/api/video/'.trim(strrchr($_GET["ID"], '/'),'/')); | ||||
|  $file = json_decode($data,true); | ||||
|  | ||||
| echo "Download URL:<br>https:"; | ||||
| echo $file[0]['uri']; | ||||
| } | ||||
| ?> | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user