Python爬虫使用实例-漫kzhan

news2024/9/27 5:46:51

环境配置

pip install shutil parsel pillow pypdf

1/ 单个章节

singleChapter

需要获取参数:chapter_id与comic_id,可能要sign和uid

获取请求地址
在这里插入图片描述

url='https://comic.mkzhan.com/chapter/content/v1/' # 请求地址

获取请求参数
在这里插入图片描述

data={
    'chapter_id':'499715',
    'comic_id':'209405',
    'format':'1',
    'quality':'1',
    'sign':'0',
    'type':'1',
    'uid':'0',
}

在这里插入图片描述

for index in response.json()['data']['page']:
    img_url=index['image']

实现代码:

# 单个章节
import requests
url='https://comic.mkzhan.com/chapter/content/v1/' # 请求地址
data={
    #'chapter_id':'997698',
    'chapter_id':'639648',
    'comic_id':'211604',
    'format':'1',
    'quality':'1',
    'sign':'bf511db7ee8e01fd18a888b0039cfefa',
    'type':'1',
    'uid':'75377874',
}
# 模拟伪装
headers={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.139 Safari/537.36'}
# 发送请求
response = requests.get(url=url, params=data, headers=headers)
# print(response) # <Response [200]>
# print(response.json())
img_name = 1
for index in response.json()['data']['page']:
    # print(index)
    img_url=index['image']
    # print(img_url)
    img_content = requests.get(url=img_url, headers = headers).content
    with open('output\\' + str(img_name)+'.jpg',mode='wb') as f:
        f.write(img_content)
    img_name += 1

2/ 合成长图

longPicture
需要获取参数:chapter_id与comic_id,可能要sign和uid

用 Python 的 os 模块来检查文件夹是否存在,如果不存在,则创建它。

# 检查文件夹是否存在,若不存在则创建
if not os.path.exists(folder_path):
    os.makedirs(folder_path)

合成长图,要将文件夹中的所有jpg图片合并成一张长图,可以使用 python 的 pillow 库。读取指定文件夹中的所有jpg图片,并将它们依次合并成一张长图。

  1. 导入库:os库用于文件处理,Image 用于图片操作。读取指定文件夹中的所有.jpg 图片,并按名称排序。
  2. 排序: 在 images.sort() 中,将排序方式更改为通过提取文件名中的数字进行排序。 key=lambda x: int(os.path.splitext(x)[0]) 先去掉文件扩展名,再将其转换为整数进行排序。使用 img[:-4].isdigit() 只保留文件名的数字部分。
# 按数字顺序排序,提取数字,然后排序
# 只保留文件名是数字的文件
images = [img for img in images if img[:-4].isdigit()]  
images.sort(key=lambda x: int(os.path.splitext(x)[0]))
  1. 计算:算所有图片的总高度和最大宽度,以便创建合成图像。
  2. 创建新图像: 使用 Image.new 创建一张新的空白图像。逐一将读取的图片粘贴到新图像中。
  3. 保存图像: 将合成后的图像保存到指定路径。
  4. 生成长图后用 os.remove() 函数删除原始图片(仅保留merged.jpg)

实现代码:

# 单个章节并合成长图
import os
from PIL import Image
import requests
url='https://comic.mkzhan.com/chapter/content/v1/' # 请求地址
data={
    'chapter_id':'639633',
    'comic_id':'211604',
    'format':'1',
    'quality':'1',
    'type':'1',
} # 请求参数
# 模拟伪装
headers={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.139 Safari/537.36'}
# 发送请求
response = requests.get(url=url, params=data, headers=headers)
# print(response) # <Response [200]>
# print(response.json())
# 获取
def get_img():
    img_name = 1
    # 检查文件夹是否存在,若不存在则创建
    folder = 'output\\'
    if not os.path.exists(folder):
        os.makedirs(folder)
    for index in response.json()['data']['page']:
        # print(index)
        img_url = index['image']
        # print(img_url)
        img_content = requests.get(url=img_url, headers=headers).content
        with open(folder + str(img_name) + '.jpg', mode='wb') as f:
            f.write(img_content)
        img_name += 1
        
# 合并当前章节的图片为长图, 按顺序
def merge_images_vertically_in_order():
    image_folder = 'output\\'
    # 获取文件夹中的所有 JPG 文件
    images = [img for img in os.listdir(image_folder) if img.endswith('.jpg')]

    # 按数字顺序排序,提取数字,然后排序
    images = [img for img in images if img[:-4].isdigit()]  # 只保留文件名是数字的文件
    images.sort(key=lambda x: int(os.path.splitext(x)[0]))

    # 打开所有图片并获取它们的宽度和高度
    image_objects = [Image.open(os.path.join(image_folder, img)) for img in images]

    # 计算最终长图的总高度和最大宽度
    total_height = sum(img.height for img in image_objects)
    max_width = max(img.width for img in image_objects)

    # 创建一张新的空白图像,用于存放合成的长图
    new_image = Image.new('RGB', (max_width, total_height))

    # 逐个将图片粘贴到新图像上
    current_height = 0
    for img in image_objects:
        new_image.paste(img, (0, current_height))
        current_height += img.height

    # 保存合成的长图
    new_image.save('output\\merged.jpg')
    print(f'合成的长图已保存为: output\\merged.jpg')

    # 移除原始图片
    for img in images:
        os.remove(os.path.join(image_folder, img))
    print(f'原始图片已删除.')

# 使用示例
get_img()
# merge_images_vertically()
merge_images_vertically_in_order()

3/ 全部章节

multiChapter
需要获取参数:comic_id,可能要sign和uid
合并为长图,并合并长图为pdf

把长图放在图的上一级便于取用:用 Python 的 shutil 模块中的 move() 函数。将指定路径下的文件移动到其上一级文件夹。

shutil.move(long_img_path, os.path.join(main_folder, f'{chapter_name}.png'))

使用 PyPDF2(或 pypdf)库来将文件夹中的图片按顺序(如果有最终话或者最后话的话放在最后面,序章则放在最前面)合并成 PDF.

实现代码:

# 当然文件名之类的可能还需要修改一下
import os
import shutil
import requests
import parsel
from PIL import Image
from pypdf import PdfWriter
url1='https://www.mkzhan.com/214829/' # 请求地址
# 模拟伪装
headers={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.139 Safari/537.36'}
html_data=requests.get(url=url1,headers=headers).text
#print(html_data)
# css 数据解析
selector = parsel.Selector(html_data)
list = selector.css('.chapter__list .chapter__list-box .chapter__item')

long_images = [] # 用于存放所有章节长图的列表

# 创建主文件夹
main_folder = 'output\\XⅪ.Awaken'
if not os.path.exists(main_folder):
    os.makedirs(main_folder)
# 获取数据
def get_data():
    # for i in list(reversed(list)):
    for i in list:
        chapter_id = i.css('a::attr(data-chapterid)').get()
        chapter_name = i.css('a::text').getall()[-1].strip()

        print(chapter_id, chapter_name)

        # 创建章节文件夹
        chapter_folder = os.path.join(main_folder, chapter_name)
        if not os.path.exists(chapter_folder):
            os.makedirs(chapter_folder)

        # 请求参数
        data = {
            'chapter_id': chapter_id,
            'comic_id': '214829',  # 此
            'format': '1',
            'quality': '1',
            'type': '1',
        }

        # 发送请求
        url = 'https://comic.mkzhan.com/chapter/content/v1/'
        response = requests.get(url=url, params=data, headers=headers)

        img_name = 1
        images = []

        for index in response.json()['data']['page']:
            img_url = index['image']
            img_content = requests.get(url=img_url, headers=headers).content

            # 确保 chapter_name 是一个有效的文件夹名称
            chapter_name = chapter_name.replace('/', '-').replace('\\', '-').replace(':', '-').replace('*',
                                                                                                            '-').replace(
                '?', '').replace('"', '').replace('<', '').replace('>', '').replace('|', '')

            # 图片文件路径
            img_file_path = os.path.join(chapter_folder, f'{chapter_name}_{img_name}.png')
            # 检查图是否已存在
            if os.path.exists(img_file_path):
                print(f"图 {img_file_path} 已存在。")
            else:
                with open(img_file_path, mode='wb') as f:
                    f.write(img_content)

            images.append(img_file_path)
            img_name += 1

        # 合并当前章节的图片为长图
        if images:
            total_height = 0
            max_width = 0
            images_to_merge = []

            for img_path in images:
                img = Image.open(img_path)
                total_height += img.height
                max_width = max(max_width, img.width)
                images_to_merge.append(img)

            long_img = Image.new('RGB', (max_width, total_height))
            current_height = 0

            for img in images_to_merge:
                long_img.paste(img, (0, current_height))
                current_height += img.height

            long_img_path = os.path.join(chapter_folder, f'{chapter_name}.png')
            # 检查长图是否已存在
            if os.path.exists(long_img_path):
                print(f"长图 {long_img_path} 已存在。")
            else:
                long_img.save(long_img_path)
                long_images.append(long_img_path)

            long_img.save(long_img_path)
            long_images.append(long_img_path)
            # 移动到上一级, 即 image_folder = 'output\\XⅪ.Awaken\\'
            shutil.move(long_img_path, os.path.join(main_folder, f'{chapter_name}.png'))
# 设置图片文件夹路径和输出 PDF 文件路径
def merged_pdf():
    #image_folder = 'XⅪ.Awaken\\'  # 替换为你的图片文件夹路径
    #output_pdf_path = 'XⅪ.Awaken.pdf'  # 输出 PDF 文件路径
    image_folder = 'output\\XⅪ.Awaken\\'  # 替换为你的图片文件夹路径
    output_pdf_path = 'output\\XⅪ.Awaken\\XⅪ.Awaken.pdf'  # 输出 PDF 文件路径

    # 用于存放所有打开的图片及其标题
    images = []
    titles = []

    # 遍历文件夹中的所有图片
    for image_file in os.listdir(image_folder):
        if image_file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):  # 检查文件格式
            image_path = os.path.join(image_folder, image_file)
            img = Image.open(image_path)
            images.append(img)

            # 提取图片标题(不带扩展名)
            title = os.path.splitext(image_file)[0]
            titles.append(title)


    # 自定义排序函数
    def custom_sort_key(title):
        if "序章" in title:  # 序章放在最前
            return (0, title)
        elif "最终话" in title or "最后话" or "新oc" in title:  # 最终话放在最后
            return (2, title)
        else:
            # 提取话的数字,并放在第一排序位置
            number_part = ''.join(filter(str.isdigit, title))  # 提取数字部分
            return (1, int(number_part) if number_part.isdigit() else 0, title)


    # 根据自定义排序规则排序标题和图片
    sorted_indices = sorted(range(len(titles)), key=lambda i: custom_sort_key(titles[i]))
    images = [images[i] for i in sorted_indices]

    # 创建 PDF Writer 实例
    pdf_writer = PdfWriter()

    # 将每张图像添加到 PDF
    for img in images:
        img_pdf_path = os.path.join(image_folder, f"temp_{titles[images.index(img)]}.pdf")
        img.save(img_pdf_path, "PDF", quality=100)

        # 添加保存的 PDF 文件到 writer
        pdf_writer.append(img_pdf_path)

    # 保存生成的 PDF 文件
    with open(output_pdf_path, 'wb') as f:
        pdf_writer.write(f)

    # 清理临时文件
    for title in titles:
        os.remove(os.path.join(image_folder, f"temp_{title}.pdf"))

    print(f'PDF 文件已生成:{output_pdf_path}')


get_data()
merged_pdf()

4/ 可选章节

OptionalmultiChapter

下载comic, def get_data(start=0, end=None) 可指定章节, 通过改变参数start和end

可能要注意一下顺序, 而且有番外
在这里插入图片描述
倒序从前往后,前面的为0 正序则从后往前, 后面的为0
因为chapter_name = i.css('a::text').getall()[-1].strip() [-1]是取列表的最后一个元素, 若要reversed 可以改为[0] 此处不可
这里不能用reversed, 会报错 for i in list(reversed(list))[start:end]:

TypeError: ‘SelectorList’ object is not callable

改start值吧, 若倒序第十话 start=9 若正序第十话 start=len(list)-10
第一话start=len(list)-1 end=None也即end = len(list)

import os
import shutil
import requests
import parsel
from PIL import Image
from pypdf import PdfWriter
url1='https://www.mkzhan.com/209405/' # 请求地址
# 模拟伪装
headers={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.139 Safari/537.36'}
html_data=requests.get(url=url1,headers=headers).text
#print(html_data)
# css 数据解析
selector = parsel.Selector(html_data)
list = selector.css('.chapter__list .chapter__list-box .chapter__item')
# print(type(list))
long_images = [] # 用于存放所有章节长图的列表

# 创建主文件夹
# main_folder = 'XⅪ.Awaken'
main_folder = 'output\\非人哉'
if not os.path.exists(main_folder):
    os.makedirs(main_folder)

# 获取数据
# start: 指定开始章节的索引(默认为0)。
# end: 指定结束章节的索引(默认为None,表示获取到列表的最后一章)。
# 例如 get_data(start=0, end=10) 会获取前10章。
# get_data(start=5) 会从第5章开始获取到最后一章。
def get_data(start=len(list)-10, end=None): # 第10话, 这个正序的, 底部更新, 一般倒序的
    # 假设 list 是从某个地方获取的章节列表
    # list = get_chapter_list()  # 这里需要你自己实现获取章节列表的逻辑

    if end is None:
        end = len(list)  # 如果没有指定结束位置,默认为列表的长度

    for i in list[start:end]:  # 根据 start 和 end 的值获取章节
        #chapter_id = i.css('a::attr(data-chapterid)').get()
        #chapter_name = i.css('a::text').getall()[-1].strip()
        chapter_id = i.css('a::attr(data-chapterid)').get()
        chapter_name = i.css('a::text').getall()[-1].strip()
        # chapter_name = i.css('a::text').getall()[0].strip()
        # [0]和[-1]结果一样, 原因:HTML 结构简单, 在你处理的特定 HTML 结构中每个 <a> 标签只包含了一个完整的文本节点,
        # 因此取第一个或最后一个节点都返回相同的字符串。

        print(chapter_id, chapter_name)

        # 创建章节文件夹
        chapter_folder = os.path.join(main_folder, chapter_name)
        if not os.path.exists(chapter_folder):
            os.makedirs(chapter_folder)

        # 请求参数
        data = {
            'chapter_id': chapter_id,
            'comic_id': 209405,  # 此
            'format': '1',
            'quality': '1',
            'type': '1',
        }

        # 发送请求
        url = 'https://comic.mkzhan.com/chapter/content/v1/'
        response = requests.get(url=url, params=data, headers=headers)

        img_name = 1
        images = []

        for index in response.json()['data']['page']:
            img_url = index['image']
            print(img_url)
            img_content = requests.get(url=img_url, headers=headers).content

            # 确保 chapter_name 是一个有效的文件夹名称
            chapter_name = chapter_name.replace('/', '-').replace('\\', '-').replace(':', '-').replace('*',
                                                                                                       '-').replace('?',
                                                                                                                    '').replace(
                '"', '').replace('<', '').replace('>', '').replace('|', '')

            # 图片文件路径
            img_file_path = os.path.join(chapter_folder, f'{chapter_name}_{img_name}.png')
            # 检查图是否已存在
            if os.path.exists(img_file_path):
                print(f"图 {img_file_path} 已存在。")
            else:
                with open(img_file_path, mode='wb') as f:
                    f.write(img_content)

            images.append(img_file_path)
            img_name += 1

            # 合并当前章节的图片为长图
        if images:
            total_height = 0
            max_width = 0
            images_to_merge = []

            for img_path in images:
                img = Image.open(img_path)
                total_height += img.height
                max_width = max(max_width, img.width)
                images_to_merge.append(img)

            long_img = Image.new('RGB', (max_width, total_height))
            current_height = 0

            for img in images_to_merge:
                long_img.paste(img, (0, current_height))
                current_height += img.height

            long_img_path = os.path.join(chapter_folder, f'{chapter_name}.png')
            # 检查长图是否已存在
            if os.path.exists(long_img_path):
                print(f"长图 {long_img_path} 已存在。")
            else:
                long_img.save(long_img_path)
                long_images.append(long_img_path)

            long_img.save(long_img_path)
            long_images.append(long_img_path)
            # 移动到上一级, 即 image_folder = 'output\\XⅪ.Awaken\\'
            shutil.move(long_img_path, os.path.join(main_folder, f'{chapter_name}.png'))

# 设置图片文件夹路径和输出 PDF 文件路径
def merged_pdf():
    # image_folder = 'XⅪ.Awaken\\'  # 替换为你的图片文件夹路径
    # output_pdf_path = 'XⅪ.Awaken.pdf'  # 输出 PDF 文件路径
    image_folder = 'output\\非人哉\\'  # 替换为你的图片文件夹路径
    output_pdf_path = 'output\\非人哉\\非人哉.pdf'  # 输出 PDF 文件路径

    # 用于存放所有打开的图片及其标题
    images = []
    titles = []

    # 遍历文件夹中的所有图片
    for image_file in os.listdir(image_folder):
        if image_file.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):  # 检查文件格式
            image_path = os.path.join(image_folder, image_file)
            img = Image.open(image_path)
            images.append(img)

            # 提取图片标题(不带扩展名)
            title = os.path.splitext(image_file)[0]
            titles.append(title)

    # 自定义排序函数
    def custom_sort_key(title):
        if "序章" in title:  # 序章放在最前
            return (0, title)
        elif "最终话" in title or "最后话" or "新oc" in title:  # 最终话放在最后
            return (2, title)
        else:
            # 提取话的数字,并放在第一排序位置
            number_part = ''.join(filter(str.isdigit, title))  # 提取数字部分
            return (1, int(number_part) if number_part.isdigit() else 0, title)

    # 根据自定义排序规则排序标题和图片
    sorted_indices = sorted(range(len(titles)), key=lambda i: custom_sort_key(titles[i]))
    images = [images[i] for i in sorted_indices]

    # 创建 PDF Writer 实例
    pdf_writer = PdfWriter()

    # 将每张图像添加到 PDF
    for img in images:
        img_pdf_path = os.path.join(image_folder, f"temp_{titles[images.index(img)]}.pdf")
        img.save(img_pdf_path, "PDF", quality=100)

        # 添加保存的 PDF 文件到 writer
        pdf_writer.append(img_pdf_path)

    # 保存生成的 PDF 文件
    with open(output_pdf_path, 'wb') as f:
        pdf_writer.write(f)

    # 清理临时文件
    for title in titles:
        os.remove(os.path.join(image_folder, f"temp_{title}.pdf"))

    print(f'PDF 文件已生成:{output_pdf_path}')

get_data()
# merged_pdf()

5/ 常见问题

转pdf时常见的报错

OSError: encoder error -2 when writing image file

可能的原因:文件太大了, 有的图片几十MB一个,如果有几十几百章, 占内存很大, 可能内存不足, 如果处理的文件非常大,可能会导致物理内存不足。如果可能的话,尝试在具有更高可用内存的环境中运行代码或者尝试将其压缩或降低分辨率。

在这里插入图片描述


还有一个常见的就是不报错,但是返回空。

获取数据不稳定,有时有又是没有,可能的原因:

  1. 访问频率限制(过于频繁会返回空的响应)
  2. 网络不稳定(网络异常导致获取数据失败)
  3. 网站使用javascript加载动态页面,导致无法获取完整html内容,标签为空
  4. 代码错误:正则表达式匹配规则有误or不准确,数据没有正确解析

6/ 源码附件

  • https://lightly.teamcode.com/a67bdf54/mkzhan
  • https://download.csdn.net/download/weixin_45693567/89717244

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2109892.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

LiveQing视频点播流媒体RTMP推流服务功能-支持大疆等无人机RTMP推流支持OBS推流一步一步搭建RTMP视频流媒体服务示例

LiveQing支持大疆等无人机RTMP推流支持OBS推流一步一步搭建RTMP视频流媒体服务示例 1、流媒体服务搭建2、推流工具准备3、创建鉴权直播间4、获取推流地址5、配置OBS推流6、推流及播放7、获取播放地址7.1 页面查看视频源地址7.2 接口查询 8、相关问题8.1、大疆无人机推流花屏 9、…

湖南(竞品调研)源点咨询 品牌进行有效竞争对手分析之浅见

在做品牌竞品调研时&#xff0c;首先在选择对标品牌的时候定要选择同赛道的&#xff0c;其次要深入地做好调研&#xff0c;搜集同品类、同赛道的品牌、门店调研。 同时&#xff0c;对竞品的调研一定要全面的分析他们的优势、劣势&#xff0c;充分学习他们身上的优点&#xff0…

2024 年全国大学生数学建模竞赛论文资料

获取比赛资料&#xff0c;请关注WX&#xff1a;“小何数模”&#xff01; &#xff08;需要完整B、C和E题资料请关注WX&#xff1a;“小何数模”&#xff01;&#xff0c;获取资料链接&#xff01;&#xff09; 经过团队努力&#xff0c;今年国赛数学建模B、C和E题完整论文资…

【mysql】mysql之主从部署以及介绍

本站以分享各种运维经验和运维所需要的技能为主 《python零基础入门》&#xff1a;python零基础入门学习 《python运维脚本》&#xff1a; python运维脚本实践 《shell》&#xff1a;shell学习 《terraform》持续更新中&#xff1a;terraform_Aws学习零基础入门到最佳实战 《k8…

高压喷雾车的功能与应用_鼎跃安全

在一次森林火灾中&#xff0c;位于山区的一个小型度假村附近突然起火&#xff0c;由于山风强劲&#xff0c;火势迅速蔓延&#xff0c;消防部门立即调派多辆高压喷雾车赶往现场。在扑救过程中&#xff0c;传统消防车难以进入崎岖的山路&#xff0c;但高压喷雾车凭借其高机动性顺…

调度台在现代社会中发挥哪些重要作用

在当今这个高度信息化、快节奏的社会中&#xff0c;调度台作为各行各业运行管理的中枢神经&#xff0c;正发挥着日益重要的作用。它不仅是一个物理上的工作平台&#xff0c;更是信息汇聚、指令发出、资源调配的核心节点&#xff0c;对于保障社会正常运转、提升服务效率、应对突…

百度智能云向量数据库创新和应用实践分享

本文整理自第 15 届中国数据库技术大会 DTCC 2024 演讲《百度智能云向量数据库创新和应用实践分享》 在 IT 行业&#xff0c;数据库有超过 70 年的历史了。对于快速发展的 IT 行业来说&#xff0c;一个超过 70 年历史的技术&#xff0c;感觉像恐龙一样&#xff0c;非常稀有和少…

JVM系列(六) -对象的创建过程

一、摘要 在之前的文章中,我们介绍了类加载的过程和 JVM 内存布局相关的知识。本篇我们综合之前的知识,结合代码一起推演一下对象的真实创建过程,以及对象创建完成之后在 JVM 中是如何保存的。 二、对象的创建 在 Java 中,创建对象的方式有很多种,比如最常见的通过new …

【SpringBoot】使用Redis

目录 0. 安装Redis 1. 导入依赖 2. 配置Redis 3. idea连接Redis 4. 使用Redis简单实现记录访问次数 1. 配置拦截器 2. 定义拦截器 3. 控制器类 0. 安装Redis 我使用的是本地Redis服务器&#xff0c;安装过程。安装完成后启动Redis服务。 1. 导入依赖 <!-- red…

SQL常见100面试题解析

文章目录 内容简介SQL 初级查询SQL 高级查询设计与开发总结 内容简介 本文介绍并分析了常见的 100 道 SQL 面试题&#xff0c;主要分为三个模块&#xff1a;SQL 初级查询、SQL 高级查询以及数据库设计与开发。内容结构如下图所示&#xff1a; 本文主要使用三个示例表&#xf…

Github 2024-09-06 Java开源项目日报Top10

根据Github Trendings的统计,今日(2024-09-06统计)共有10个项目上榜。根据开发语言中项目的数量,汇总情况如下: 开发语言项目数量Java项目9TypeScript项目2非开发语言项目1JavaGuide - Java 程序员学习和面试指南 创建周期:2118 天开发语言:Java协议类型:Apache License …

Java队列详细解释

队列 一、什么是队列&#xff08;Queue&#xff09; java队列是一种线性数据结构&#xff0c;它的特点是先进先出。在队列中&#xff0c;元素的添加&#xff08;入队&#xff09;操作在队尾进行&#xff0c;而元素的移除&#xff08;出队&#xff09;操作则在队头进行。因此&a…

『功能项目』账号登陆注册界面UI搭建【27】

打开上一篇26DOTween动态文字的项目&#xff0c; 本章要做的事情是搭建账号登录界面&#xff0c;输入账号及密码存储到本地数据库&#xff0c;本地数据库数据是否可登陆游戏进入游戏场景&#xff0c;如果没有账号可以通过账号注册来进入游戏&#xff0c;之后每次账号输入使用注…

项目日志——框架模块设计实用工具类的设计、实现、测试

文章目录 框架模块设计功能叙述模块划分模块关系图 实用工具类设计实现测试 框架模块设计 功能叙述 日志系统的作用就是将一条消息格式化指定格式的字符串之后&#xff0c;写入到指定位置 这个指定位置就有说法了 标准输出指定文件滚动文件 我们可以写入到其中的一种&…

半天攻略:用ChatGPT快速搞定高质量论文,从选题到完稿一站式指南!

在学术论文的撰写过程中&#xff0c;ChatGPT可以作为一个强大的辅助工具&#xff0c;帮助完成从确定主题到整理参考文献的各个环节。接下来&#xff0c;我们将详细介绍如何利用ChatGPT提升论文写作的效率和质量。 确定论文主题 初步探索&#xff1a;通过ChatGPT探索主题&#…

UAEXpert连接kepserver的OPC服务时,出现BadCertificateHostNamelnvalid报错--解决办法

描述&#xff1a; 虚拟机win10安装kepserver&#xff0c;本机的uaexpert软件连接虚拟机上的OPC UA服务&#xff0c;遇到BadCertificateHostNamelnvalid报错问题 报错信息如下&#xff1a; Error BadCertificateHostNamelnvalidwas returned during CreateSession,press Ignor…

Spring事务和事务传播机制(下)

我们上一篇文章学习了 Transactional 的基本使用。接下来我们学习 Transactional 注解的使用细节。 Transactional 注解当中有下面三个常见属性&#xff1a; 1、rollbackFor&#xff1a;异常回滚属性。指定能够触发事务回滚的异常类型。可以指定多个异常类型 2、IsoIation&…

开学季好物狂欢,这些神仙好物让你开学季事半功倍!

随着秋风送爽&#xff0c;开学季再次悄然而至。对于即将迎接新学期的学生们来说&#xff0c;这不仅仅是一个新起点&#xff0c;也是准备全新装备、挑战更高学习效率的好时机。在这个特殊的时节&#xff0c;我们特别为大家策划了一场“开学季好物狂欢”&#xff0c;精选了一系列…

数字人直播防封技巧升级!头部源码厂商如何实现7*24小时无间断直播?

当前&#xff0c;许多用户在使用数字人直播的过程中都遇到了直播间违规和账号被封两大问题&#xff0c;并因此蒙受了一定的损失。在此背景下&#xff0c;不少有计划引入数字人直播的企业和搭建数字人直播系统的创业者也开始有了犹豫。为了让大家能够更放心地入局&#xff0c;本…

Linux之MySQL日志

前言 数据库就像一个庞大的图书馆&#xff0c;而日志则是记录这个图书馆内每一本书的目录。正如在图书馆中找到特定书籍一样&#xff0c;数据库日志帮助我们追溯数据的变更、定位问题和还原状态。 在MySQL中&#xff0c;日志是非常重要的一个组成部分&#xff0c;它记录了数据…