KernelChan/getKernelInfo.py

25 lines
802 B
Python
Raw Normal View History

2021-04-30 02:47:06 +02:00
import urllib.request
import os
from bs4 import BeautifulSoup
2021-05-01 14:52:55 +02:00
# TODO: Change Bash cut to RegEx and fix the Version sorting
2021-04-30 02:47:06 +02:00
theurl = "https://archive.archlinux.org/packages/l/linux/"
thepage = urllib.request.urlopen(theurl)
2021-05-01 22:24:33 +02:00
soup = BeautifulSoup(thepage, features="lxml")
2021-04-30 02:47:06 +02:00
project_href = [i['href'] for i in soup.find_all('a', href=True)]
del project_href[0]
2021-05-01 21:02:46 +02:00
KernelURL = []
2021-04-30 02:47:06 +02:00
KernelVerList = []
2021-05-01 22:26:27 +02:00
## Making complicated stuff to extract only the Kernel Version from the WebScrap
2021-04-30 02:47:06 +02:00
for t in project_href[::2]:
KernelURL.append("https://archive.archlinux.org/packages/l/linux/"+t)
2021-05-01 21:02:46 +02:00
KernelVer = os.popen("echo " + t + " | cut -d'.' -f1,2,3 | sed 's/.arc//g' | sed 's/-x86_64//g' | sed 's/.ar//g' | sed 's/h//g'")
2021-04-30 02:47:06 +02:00
for i in KernelVer.read().split('\n')[::2]:
KernelVerList.append(i)