PotPlayer部分版本使用Ctrl+U(界面右键→打开→打开链接)打开播放链接会有几十秒的卡顿,平时用直播源不方便,偶然看到解决办法,记下。

方法:

按F5或右键打开设置

勾选保存设置到INI文件,记得点确定或应用,不然生成的文件只有几行

然后点击右边的三个点,自动定位到文件所在位置

用记事本或其他编辑器修改PotPlayerMini.ini文件,这里用的是Notepad++

查找LastUrlList,一般应该没有,手动添加到这几个条目附近,确保在Settings下

=号后随便输一个文件名,稍后会用到

记得保存更改后的ini文件

找到PotPlayer安装的路径,打开文件夹,参考C:\Program Files\PotPlayer64\Extension\Media\UrlList

可见如下两个文件

新建一个文件,重命名为 MediaUrlList –  加上刚刚的那个名字,如MediaUrlList – aabbcc.as,需要打开文件扩展名

修改这个文件,记事本或其他编辑器打开

油管这个文件里的代码贴出来,仅供参考

  1 /*
  2     media url search by youtube
  3 
  4 */
  5 
  6 // void OnInitialize()
  7 // void OnFinalize()
  8 // string GetTitle()                                     -> get title for UI
  9 // string GetVersion                                    -> get version for manage
 10 // string GetDesc()                                        -> get detail information
 11 // string GetLoginTitle()                                -> get title for login dialog
 12 // string GetLoginDesc()                                -> get desc for login dialog
 13 // string GetUserText()                                    -> get user text for login dialog
 14 // string GetPasswordText()                                -> get password text for login dialog
 15 // string ServerCheck(string User, string Pass)         -> server check
 16 // string ServerLogin(string User, string Pass)         -> login
 17 // void ServerLogout()                                     -> logout
 18 //------------------------------------------------------------------------------------------------
 19 // array<dictionary> GetCategorys()                        -> get category list
 20 // string GetSorts(string Category, string Extra, string PathToken, string Query)                                    -> get sort option
 21 // array<dictionary> GetUrlList(string Category, string Extra, string PathToken, string Query, string PageToken)    -> get url list for Category
 22 
 23 string GetTitle()
 24 {
 25 return "{$CP949=유튜브$}{$CP0=YouTube$}";
 26 }
 27 
 28 string GetVersion()
 29 {
 30     return "1";
 31 }
 32 
 33 string GetDesc()
 34 {
 35     return "https://www.youtube.com/";
 36 }
 37 
 38 array<dictionary> GetCategorys()
 39 {
 40     array<dictionary> ret;
 41     
 42     dictionary item1;
 43     item1["title"] = "{$CP949=가장 인기 많은 영상$}{$CP950=發燒影片/頻道$}{$CP0=Most/Least Viewed$}";
 44     item1["Category"] = "most";
 45     item1["type"] = "search";
 46     item1["Genres"] = "video={$CP949=비디오$}{$CP950=發燒影片$}{$CP0=video$},channel={$CP949=채널$}{$CP950=頻道$}{$CP0=channel$}";
 47     ret.insertLast(item1);
 48 
 49     return ret;
 50 }
 51 
 52 string GetStringValue(string param, string key)
 53 {
 54     int p = param.find(key + "=");
 55 
 56     if (p >= 0)
 57     {
 58         p += key.length() + 1;
 59 
 60         int e = param.find(",", p + 1);        
 61         if (e < p) e = param.length();
 62         return param.substr(p, e - p);
 63     }
 64     return "";
 65 }
 66 
 67 string GetSorts(string Category, string Extra, string PathToken, string Query)
 68 {
 69     string sorts;
 70     string type = GetStringValue(Extra, "genre");
 71     
 72     if (!Query.empty() || type == "channel")
 73     {
 74         sorts = "relevance={$CP949=연관순$}{$CP950=依關聯性$}{$CP0=by relevance$}";
 75         sorts += ",date={$CP949=날짜순$}{$CP950=依上傳日期$}{$CP0=by date$}";
 76         sorts += ",rating={$CP949=평점순$}{$CP950=依評分$}{$CP0=by rating$}";
 77         sorts += ",title={$CP949=제목순$}{$CP950=依標題$}{$CP0=by title$}";
 78         sorts += ",videoCount={$CP949=비디오 갯수순$}{$CP950=依影片數量$}{$CP0=by video count$}";
 79         sorts += ",viewCount={$CP949=시청순$}{$CP950=依觀看次數$}{$CP0=by view count$}";
 80     }
 81     return sorts;
 82 }
 83 
 84 string FixHtmlSymbols(string inStr)
 85 {
 86     inStr.replace("&quot;", "\"");
 87     inStr.replace("&amp;", "&");
 88     inStr.replace("'", "\'");
 89     inStr.replace("'", "\'");
 90     inStr.replace("\\n", "\r\n");
 91     inStr.replace("\n", "\r\n");
 92     inStr.replace("\\", "");
 93 
 94     inStr.replace(" - YouTube", "");
 95     inStr.replace(" on Vimeo", "");
 96 
 97     return inStr;
 98 }
 99 
100 bool AssignMetaData(dictionary &item, JsonValue &in snippet)
101 {
102     bool IsDel = false;
103     
104     JsonValue title = snippet["title"];
105     if (title.isString())
106     {
107         string str = FixHtmlSymbols(title.asString());
108 
109         item["title"] = str;
110         IsDel = "Deleted video" == str;
111     }
112 
113     JsonValue channelTitle = snippet["channelTitle"];
114     if (channelTitle.isString())
115     {
116         string str = channelTitle.asString();
117 
118         item["author"] = str;
119     }
120 
121     JsonValue description = snippet["description"];
122     if (description.isString())
123     {
124         string str = description.asString();
125 
126         item["desc"] = str;
127     }
128 
129     JsonValue publishedAt = snippet["publishedAt"];
130     if (publishedAt.isString())
131     {
132         string str = publishedAt.asString();
133 
134         item["date"] = str;
135     }
136     
137     JsonValue thumbnails = snippet["thumbnails"];
138     if (thumbnails.isObject())
139     {
140         JsonValue medium = thumbnails["medium"];
141         string thumbnail;
142 
143         if (medium.isObject())
144         {
145             JsonValue url = medium["url"];
146 
147             if (url.isString()) thumbnail = url.asString();
148         }
149         if (thumbnail.empty())
150         {
151             JsonValue def = thumbnails["default"];
152 
153             if (def.isObject())
154             {
155                 JsonValue url = def["url"];
156 
157                 if (url.isString()) thumbnail = url.asString();
158             }
159         }
160         /*
161         JsonValue high = thumbnails["high"];
162         if (high.isObject())
163         {
164             JsonValue url = high["url"];
165 
166             if (url.isString()) thumbnail = url.asString();
167         }*/
168         if (!thumbnail.empty()) item["thumbnail"] = thumbnail;
169     }
170     else if (IsDel) return false;
171     return true;
172 }
173 
174 array<dictionary> GetUrlList(string Category, string Extra, string PathToken, string Query, string PageToken)
175 {
176     array<dictionary> ret;
177     string type = GetStringValue(Extra, "genre");
178     string video = "video";
179     string channel = "channel";
180     string api;
181     
182     if (type.empty()) type = video;
183     if (Query.empty() && type == video)
184     {
185         string ctry = HostIso3166CtryName();
186 
187         api = "https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular&maxResults=50&regionCode=" + ctry;
188     }    
189     else
190     {
191         string add;
192 
193         if (type == channel && !PathToken.empty())
194         {
195             if (PageToken.empty())
196             {
197                 dictionary item;
198             
199                 item["title"] = "..";
200                 item["folder"] = "parent";
201                 ret.insertLast(item);
202             }
203             type = video;
204             add = PathToken;
205         }
206         api = "https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=50&type=" + type + "&q=" + HostUrlEncode(Query);
207         if (!Extra.empty())
208         {
209             string order = GetStringValue(Extra, "sort");
210 
211             if (!order.empty()) api += "&order=" + order;
212         }
213         if (!add.empty()) api += "&channelId=" + add;
214         if (Query.empty())
215         {
216             string ctry = HostIso3166CtryName();
217 
218             api += "&regionCode=" + ctry;
219         }
220     }
221     if (!PageToken.empty())
222     {
223         api = api + "&pageToken=" + PageToken;
224         PageToken = "";
225     }
226     string json = HostUrlGetStringGoogle(api);
227     JsonReader Reader;
228     JsonValue Root;
229     if (Reader.parse(json, Root) && Root.isObject())
230     {
231         JsonValue items = Root["items"];
232 
233         if (items.isArray())
234         {
235             JsonValue nextPageToken = Root["nextPageToken"];
236             if (nextPageToken.isString()) PageToken = nextPageToken.asString();
237 
238             for (int i = 0, len = items.size(); i < len; i++)
239             {
240                 JsonValue item = items[i];
241 
242                 if (item.isObject())
243                 {
244                     JsonValue id = item["id"];
245 
246                     if (id.isString() || id.isObject())
247                     {
248                         JsonValue snippet = item["snippet"];
249 
250                         if (snippet.isObject())
251                         {
252                             if (type == channel)
253                             {
254                                 string cid;
255 
256                                 if (id.isString()) cid = id.asString();
257                                 else if (id.isObject())
258                                 {
259                                     JsonValue videoId = id["channelId"];
260 
261                                     if (videoId.isString()) cid = videoId.asString();
262                                 }
263                                 if (!cid.empty())
264                                 {
265                                     dictionary item;
266                                     
267                                     item["url"] = "https://www.youtube.com/channel/" + cid;
268 
269                                     if (!AssignMetaData(item, snippet)) continue;
270                                     item["folder"] = "1";
271                                     item["PathToken"] = cid;
272                                     ret.insertLast(item);
273                                 }
274                             }
275                             else
276                             {                        
277                                 string vid;
278 
279                                 if (id.isString()) vid = id.asString();
280                                 else if (id.isObject())
281                                 {
282                                     JsonValue videoId = id["videoId"];
283 
284                                     if (videoId.isString()) vid = videoId.asString();
285                                 }
286                                 if (!vid.empty())
287                                 {
288                                     dictionary item;
289 
290                                     item["url"] = "http://www.youtube.com/watch?v=" + vid;
291 
292                                     if (!PageToken.empty())
293                                     {
294                                         item["PageToken"] = PageToken;
295                                         PageToken = "";
296                                     }
297                                     
298                                     if (!AssignMetaData(item, snippet)) continue;
299                                     ret.insertLast(item);
300                                 }
301                             }
302                         }
303                     }
304                 }
305             }
306         }
307     }
308     return ret;
309 }

MediaUrlList – YouTube.as

新建的文件把下面这段代码放进去就可以

 1 /*
 2     解决【打开链接】卡顿
 3 
 4 */
 5 
 6 // string GetTitle()                                     -> get title for UI
 7 // string GetVersion                                    -> get version for manage
 8 // string GetDesc()                                        -> get detail information
 9 // string GetLoginTitle()                                -> get title for login dialog
10 // string GetLoginDesc()                                -> get desc for login dialog
11 // string GetUserText()                                    -> get user text for login dialog
12 // string GetPasswordText()                                -> get password text for login dialog
13 // string ServerCheck(string User, string Pass)         -> server check
14 // string ServerLogin(string User, string Pass)         -> login
15 // void ServerLogout()                                     -> logout
16 // array<dictionary> GetCategorys()                        -> get category list
17 // string GetSorts(string Category, string Extra, string PathToken, string Query)                                    -> get sort option
18 // array<dictionary> GetUrlList(string Category, string Extra, string PathToken, string Query, string PageToken)    -> get url list for Category
19 
20 string GetTitle()
21 {
22 return "{$CP0=解决【打开链接】卡顿$}";
23 }
24 
25 string GetVersion()
26 {
27     return "1";
28 }
29 
30 string GetDesc()
31 {
32     return "";
33 }
34 
35 array<dictionary> GetCategorys()
36 {
37     array<dictionary> ret;
38     
39     dictionary item1;
40     item1["title"] = "{$CP0=(推荐)$}";
41     item1["Category"] = "most";
42     item1["type"] = "search";
43     item1["Genres"] = "";
44     ret.insertLast(item1);
45 
46     return ret;
47 }
48 
49 string GetStringValue(string param, string key)
50 {
51     return "";
52 }
53 
54 string GetSorts(string Category, string Extra, string PathToken, string Query)
55 {
56     string sorts;
57     return sorts;
58 }
59 
60 bool AssignMetaData(dictionary &item, JsonValue &in snippet)
61 {
62     bool IsDel = false;
63     
64     return true;
65 }
66 
67 array<dictionary> GetUrlList(string Category, string Extra, string PathToken, string Query, string PageToken)
68 {
69     array<dictionary> ret;
70 
71     return ret;
72 }

可以看出就是原来那个文件删掉了一些信息,一般Ctrl+U打开这个,由于不能访问,变得很慢,更换为这个文件后,为空,直接就能开

重新打开PotPlayer,打开链接(Ctrl+U)秒开

版权声明:本文为sheepx原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/sheepx/p/13880965.html