liuyuqi-cnb 4 days ago
parent
commit
fe4f89f61a
6 changed files with 40 additions and 3 deletions
  1. 1 0
      .gitignore
  2. 7 0
      README.md
  3. 22 2
      crawl_font/font.py
  4. 0 0
      crawl_font/utils/__init__.py
  5. 1 1
      main.py
  6. 9 0
      pyproject.toml

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+*.pyc

+ 7 - 0
README.md

@@ -2,6 +2,13 @@
 
 
 font download tool
 font download tool
 
 
+## Develop
+
+```
+uv sync
+uv run main.py
+```
+
 ## License
 ## License
 
 
 Licensed under the [Apache 2.0](LICENSE) © [liuyuqi.gov@msn.cn](https://github.com/jianboy)
 Licensed under the [Apache 2.0](LICENSE) © [liuyuqi.gov@msn.cn](https://github.com/jianboy)

+ 22 - 2
crawl_font/font.py

@@ -15,7 +15,27 @@ class Font(object):
     }
     }
     def __init__(self):
     def __init__(self):
         self.sess = requests.Session()
         self.sess = requests.Session()
-        self.sess.update_headers(self.header)
+        self.sess.headers.update(self.header)
         
         
     def run(self):
     def run(self):
-        pass
+        pass
+
+    def crawl_fontsnet(self):
+        # download 532 商用字体
+        self.sess.headers.update(
+            {
+                "Origin": "https://www.fonts.net.cn/"
+            }
+        )
+
+
+        pass
+
+    def crawl_chinaz(self):
+        pass
+    
+    def download(self):
+        pass
+
+if __name__=='__main__':
+    pass

+ 0 - 0
crawl_font/utils/__init__.py


+ 1 - 1
main.py

@@ -11,4 +11,4 @@ from crawl_font.font import Font
 
 
 if __name__=='__main__':
 if __name__=='__main__':
     font = Font()
     font = Font()
-    font.run()
+    font.run()

+ 9 - 0
pyproject.toml

@@ -0,0 +1,9 @@
+[project]
+name = "crawl-font"
+version = "0.1.0"
+description = "Add your description here"
+readme = "README.md"
+requires-python = ">=3.12"
+dependencies = [
+    "requests>=2.32.5",
+]