v2rayNG icon indicating copy to clipboard operation
v2rayNG copied to clipboard

A title fix for import sub links from clipboard

Open mablue opened this issue 2 years ago • 1 comments

subs = """https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/00.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/01.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/02.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/03.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/04.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/05.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/06.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/07.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/08.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/09.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/10.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/11.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/12.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/13.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/14.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/15.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/16.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/17.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/18.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/19.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/20.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/21.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/22.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/23.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/24.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/25.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/26.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/27.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/28.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/29.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/30.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/31.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/32.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/33.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/34.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/35.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/36.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/37.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/38.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/39.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/40.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/41.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/42.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/43.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/44.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/45.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/46.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/47.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/48.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/49.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/50.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/51.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/52.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/53.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/54.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/55.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/56.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/57.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/58.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/59.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/60.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/61.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/62.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/63.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/64.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/65.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/66.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/67.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/68.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/69.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/70.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/71.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/72.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/73.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/74.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/75.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/76.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/77.txt"""


subs += """https://raw.githubusercontent.com/mahdibland/ShadowsocksAggregator/master/sub/sub_merge.txt
https://raw.githubusercontent.com/awesome-vpn/awesome-vpn/master/all
https://raw.githubusercontent.com/freefq/free/master/v2
https://raw.githubusercontent.com/Pawdroid/Free-servers/main/sub
https://raw.githubusercontent.com/aiboboxx/v2rayfree/main/v2
https://raw.githubusercontent.com/AzadNetCH/Clash/main/V2Ray.txt
https://raw.githubusercontent.com/vpei/Free-Node-Merge/main/o/node.txt
https://raw.githubusercontent.com/tbbatbb/Proxy/master/dist/v2ray.config.txt
https://raw.fastgit.org/ripaojiedian/freenode/main/sub
https://github.xiaoku666.tk/https://raw.githubusercontent.com/ripaojiedian/freenode/main/sub
https://raw.githubusercontent.com/learnhard-cn/free_proxy_ss/main/v2ray/v2raysub"""

subs_lst=subs.split("\n")
subs_words_lst = subs.replace('\n','/').split('/')
# Program to find most frequent
# element in a list
 
from collections import Counter
 
occurence_count = Counter(subs_words_lst)
oc = dict(occurence_count.most_common()[::-1])
for sub in subs_lst:
  sub_words_lst = sub.split('/')
  sub_title = 'imported sub'
  oc[sub_title]=float('inf')
  for word in sub_words_lst:
    if oc[word]/(len(word)+1)<oc[sub_title]/(len(sub_title)+1):
      sub_title = word 
  print(oc[sub_title],'\t',sub_title,'\t',sub)



mablue avatar May 16 '23 04:05 mablue

val subs = """https://raw.githubusercontent.com/mahdibland/ShadowsocksAggregator/master/sub/sub_merge.txt
https://raw.githubusercontent.com/awesome-vpn/awesome-vpn/master/all
https://raw.githubusercontent.com/freefq/free/master/v2
https://raw.githubusercontent.com/Pawdroid/Free-servers/main/sub
https://raw.githubusercontent.com/aiboboxx/v2rayfree/main/v2
https://raw.githubusercontent.com/AzadNetCH/Clash/main/V2Ray.txt
https://raw.githubusercontent.com/vpei/Free-Node-Merge/main/o/node.txt
https://raw.githubusercontent.com/tbbatbb/Proxy/master/dist/v2ray.config.txt
https://raw.fastgit.org/ripaojiedian/freenode/main/sub
https://github.xiaoku666.tk/
https://raw.githubusercontent.com/ripaojiedian/freenode/main/sub
https://raw.githubusercontent.com/learnhard-cn/free_proxy_ss/main/v2ray/v2raysub
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/00.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/01.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/02.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/03.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/04.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/05.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/06.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/07.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/08.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/09.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/10.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/11.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/12.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/13.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/14.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/15.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/16.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/17.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/18.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/19.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/20.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/21.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/22.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/23.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/24.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/25.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/26.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/27.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/28.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/29.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/30.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/31.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/32.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/33.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/34.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/35.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/36.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/37.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/38.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/39.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/40.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/41.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/42.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/43.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/44.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/45.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/46.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/47.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/48.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/49.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/50.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/51.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/52.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/53.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/54.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/55.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/56.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/57.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/58.txt
https://raw.githubusercontent.com/mahdibland/V2RayAggregator/master/sub/list/59.txt"""
 
var subs_lst = subs.split("\n")
var subs_words_lst = subs.replace('\n','/').split('/')
 
import java.util.*
 
val occurence_count = TreeMap<String, Int>()
for (word in subs_words_lst) {
    val count = occurence_count.getOrDefault(word, 0)
    occurence_count[word] = count + 1
}
val oc = occurence_count.entries.sortedByDescending { it.value }.toMap()
for (sub in subs_lst) {
    val sub_words_lst = sub.split('/')
    var sub_title = "imported sub"
    oc[sub_title] = Int.MAX_VALUE
    for (word in sub_words_lst) {
        if (oc[word]!! / (word.length + 1) < oc[sub_title]!! / (sub_title.length + 1)) {
            sub_title = word
        }
    }
    println("${oc[sub_title]} \t $sub_title \t $sub")
}

mablue avatar May 16 '23 04:05 mablue