Skip to content

Map selection problem under the GoogleTranslator class setFormData() under jdk 1.8 #5

Description

@water-law

#title for chinese: jdk 1.8 下 GoogleTranslator 类 setFormData() 的 Map 选择问题

The formData in the setFormData() method is a HashMap, the HashMap does not support key duplication, and the google translation form submission requires a dt field, which has multiple values.

Solution: You can change the HashMap to IdentityHashMap in the AbstractHttpAttribute parent class, and then have the same key, formData.put(new String("key"), "value");

ps:
In order to support internationalization, first use English to play it again. Recently, the google translation API is not used.

setFormData() 方法中 formData 是一个 HashMap, HashMap 不支持 key 重复, 而 google 翻译表单提交时 需要 dt 字段, 该字段有多个值。

解决方案: 可以在 AbstractHttpAttribute 父类中将 HashMap 改为 IdentityHashMap, 然后有相同 key 时, formData.put(new String("key"), "value");

ps:
为了支持国际化, 先用英文打一遍, 用这个频繁调用翻译接口还是会超时,腾讯、google 他们应该有反爬虫机制。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions